fix(proxy): add arguments to Cedar context; hash all audit entries (POLICY-004, POLICY-005) - #213
Merged
Merged
Conversation
…OLICY-004, POLICY-005) Cedar context now includes the `arguments` dict so policies can inspect tool call parameter values. Every audit entry (catalog miss, Cedar deny, AGT deny, egress deny, success) now records `request_payload_hash = sha256(canonical_json(arguments))` so the audit chain commits to the exact payload that triggered each enforcement decision. Closes #143, #144 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_build_cedar_context()now includesargumentsin the returned dict, so Cedar policies can inspect tool call parameter values (e.g. block calls withpatient_idin PHI-restricted domains).audit_chain.append()call incall_tool()now receivesrequest_payload_hash = sha256(canonical_json(arguments)). Covered: catalog miss, Cedar deny, AGT gateway deny, egress deny, and the success path. The hash usessort_keys=Trueand no spaces for determinism.Test plan
test_cedar_context_includes_arguments— Cedar evaluator receivesargumentsin contexttest_audit_payload_hash_present_on_allow— success path audit entry hassha256:...hashtest_audit_payload_hash_present_on_catalog_deny— catalog-miss audit entry has hashtest_audit_payload_hash_present_on_cedar_deny— Cedar-deny audit entry has hashtest_audit_payload_hash_is_canonical_sha256— hash matches expected canonical JSON serialization🤖 Generated with Claude Code