Repository navigation
Conversation
…review - Acquire the sidecar lock in load_session_state and read via _load_unlocked inside update_session_state so concurrent readers on Windows cannot block os.replace and drop state updates. - Include microseconds and a collision counter in _backup_path so two wire runs within the same second never overwrite a backup. - Raise ImportError instead of calling sys.exit(2) in nat/wire.py when ruamel.yaml is absent so pytest collection does not abort without the nat extra. - Parse JSON-stringified tool_input in Cursor _payload_pretool and translate_response so stringified preToolUse inputs are evaluated by the Guardian instead of raising in _wrap_arguments. - Document the two default-deny effects in adapters/README.md and adapters/docs/claude_code/README.md (PostToolUse output withholding on slow/unreachable Guardian, and ImportError requiring both ACS_STARTUP_POSTURE=proceed and ACS_DEFAULT_DENY=0 to proceed). Closes GenAI-Security-Project#509 Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
|
Thanks for this. It is queued rather than ignored. A lead has not reviewed this pull request yet. A lead will read it when they have time, and we can't promise a date. Nothing here is rejected. If a check below fails, please fix it. A pull request that waits a long time may be closed, and you can reopen it later. |
|
This pull request's description says it closes #509, which is on the project roadmap. When it merges, GitHub closes that issue and the roadmap counts it as delivered. Please confirm the change delivers the whole issue before merging. |
|
@drk-ram closing this: #509 is assigned to me. Please check who holds an issue before starting on it. If you'd like to help with one, ask on the issue and wait until a lead assigns it to you, as how work gets accepted describes (D-041). A PR on work someone else holds duplicates their effort and takes review time away from the planned work. |
What changed
Resolves all five reference-adapter follow-ups tracked in the review backlog:
load_session_state(adapters/src/acs/client/_store.py): Extract_load_unlocked(path)for the raw read insideupdate_session_stateand acquire_locked(path)inload_session_stateso concurrent readers on Windows cannot blockos.replacewithPermissionErrorand drop session-state updates.adapters/src/acs/integrations/_settings_file.pyandadapters/src/acs/integrations/nat/wire.py): Add_backup_path(target)with microseconds (%Y%m%dT%H%M%S_%f) and a collision counter suffix (.1,.2, ...) so two wire runs within the same second never overwrite a backup.ImportErrorinstead ofsys.exit(2)innat/wire.py(adapters/src/acs/integrations/nat/wire.py): Whenruamel.yamlis missing, raiseImportErrorfrom the underlying exception sopytest testsdoes not abort at collection when thenatextra is not installed.tool_inputon CursorpreToolUse(adapters/src/acs/integrations/cursor/adapter.py): Parsetool_input/argumentswith_parse_json_fieldin_payload_pretool(wrapping non-dict values as{"raw_params": args}) and normalizeoriginal_inputintranslate_response, matching_payload_before_mcpso stringifiedpreToolUseinputs are evaluated by the Guardian instead of raising in_wrap_argumentsand failing open underACS_DEFAULT_DENY=0.adapters/README.mdandadapters/docs/claude_code/README.md): State under**Degraded-Guardian behavior.**and in the Claude Code README that a slow or unreachable Guardian on Claude Code withholds a tool's output afterPostToolUse, and that if the adapter fails to import it proceeds only when the agent's local config sets bothACS_STARTUP_POSTURE=proceedandACS_DEFAULT_DENY=0.Which issue does this implement
Closes #509
Refs #22, #483
meaning, so it needs no issue
Base branch
integration, because this touches the specification, schemas, a referenceimplementation, an adapter, tests, or CI
main, because every changed path is on the documentation lane allowlist inCONTRIBUTING.md
Type of change
I tested this
uv run pytest -vpasses on my machineuv run mkdocs build --strictpasses on my machineValidation commands run and results:
python -m unittest tests.client.test_store tests.common.test_hook_command.WrittenCommandsAndFiles.test_two_writes_in_the_same_second_keep_both_backups tests.integrations.nat.test_wire tests.integrations.cursor.test_adapter.JsonStringToolInputOnPreToolUse(passed: 17 tests, 8 expected NAT skips withoutnatextra)pytest tests --collect-only -qinadapters/(passed: 1391 tests collected withoutSystemExit)pytest tests/client/test_store.py tests/integrations/nat/test_wire.py -qinadapters/(passed: 7 passed, 8 skipped, 4 subtests passed)pytest tests/test_landing_page.py tests/test_site_nav.py -qat repo root (passed: 69 passed)Checklist
git commit -s(required by the DCO)Security