feat: APS governance hook driver (v2 envelope)#1
Open
aeoess wants to merge 1 commit intoScopeBlind:mainfrom
Open
feat: APS governance hook driver (v2 envelope)#1aeoess wants to merge 1 commit intoScopeBlind:mainfrom
aeoess wants to merge 1 commit intoScopeBlind:mainfrom
Conversation
Implements the APS driver that reads fixtures/inputs/*.json in sequence, evaluates each against fixtures/policy/autoresearch-safe.cedar using the official Cedar Rust engine (via cedarpy Python bindings — not a re-implementation), and emits v2 structured-envelope receipts signed with Ed25519 using the fixture seed. Conformance against conformance/verify.sh: Check 1 (schema v1-flat OR v2-envelope): PASS (4/4) Check 2 (@veritasacta/verify signatures): PASS Check 3 (chain order + parent-hash linkage): PASS Dependencies: python3, cedarpy, cryptography. Driver exits 77 when any are missing, matching the protect-mcp driver's skip-gracefully pattern. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 17, 2026
Merged
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
Implements the
aps-governance-hookconformance driver required byspec.md. Fills the placeholder atimplementations/aps-governance-hook/run.shwith a Python driver that readsfixtures/inputs/*.json, evaluates each againstfixtures/policy/autoresearch-safe.cedarvia the official Cedar engine, and emits v2 structured-envelope receipts signed with Ed25519 using the fixture seed.Conformance result
All four decisions match
expected/chain.jsonl:Design notes
cedarpy, the official Python binding around the Rustcedar-policycrate — not a re-implementation. The driver does not evaluate the policy itself; it builds the request and reads backdecision.context.X in [strings]. Cedar 4.x strict types reject that (in's LHS must be an entity). The driver rewrites, for evaluation only,context.X in [list]→[list].contains(context.X)via a targeted regex. Semantics are unchanged; the on-disk fixture policy is untouched, andpolicy_digestis computed over the original bytes.sort_keys=True,separators=(",", ":")). Sufficient for the field types these receipts carry (strings, integers, booleans, plain objects, ASCII-only keys). Documented in-line so a future contributor can lift to a full JCS library if fractional numbers ever appear in the payload.signature, which is what@veritasacta/verifyreconstructs before calling Ed25519.public_keyis embedded insidepayloadso the verifier's auto-key-lookup path succeeds without--key.payload.prev_hash = "sha256:0000…0"(cryptographic chain convention) and top-levelparent_receipt_hash = null(soconformance/verify.sh's check 3 accepts genesis as null/empty per its current wording). Subsequent receipts chain by SHA-256 of the full JCS-canonical envelope, consistent across both fields.cedarpyorcryptographyare missing, matching theprotect-mcppattern. Install withpip install cedarpy cryptography.Files
implementations/aps-governance-hook/run.sh— driver (was placeholder, now ~200 lines)receipts/aps-governance-hook/*.json— regenerated at run time; not committed (matchesprotect-mcpandsb-runtime)Test plan
pip install cedarpy cryptographybash implementations/aps-governance-hook/run.shprintsaps-governance-hook: 4 receipts in …and exits 0bash conformance/verify.sh receipts/aps-governance-hook— all 6 checks pass, exit 0expected/chain.jsonlcedarpyorcryptographyexits 77 with a skip message (matchesprotect-mcp)🤖 Generated with Claude Code