Repository navigation
fix(audit): bind attribution into the HMAC anchor (v3) — catch sealed-entry de-attribution - #177
Merged
Merged
Conversation
…-entry de-attribution The deep adversarial pass found the audit attribution layer's one unguarded move: a writer-only attacker (no private key, no anchor key) could STRIP or rewrite kid/sig on an entry that was already signed AND anchored, and every layer stayed green — the keyless chain re-hashes without kid/sig, the signature tally re-counts the entry as `unsigned` (fail-open), and the hash-only anchor tip was byte-identical. Fix: the HMAC anchor now folds attribution into the seal. New `computeAnchorTipV3` chains over `hash | kid | sig` per line (unit-separated; own domain seed), and anchor records are written at `version: 3`. Altering or removing the signer of any ANCHORED entry now moves the tip → hard `tip-mismatch`; forging kid/sig onto a sealed keyless entry is caught the same way. `verifyAgainstAnchor` picks the fold algorithm from the record version, so legacy v≤2 anchors keep verifying hash-only until the next `kit audit anchor` re-seals them as v3 (backward-compatible, self-migrating). Not changed: signing over `hash` alone is kept — binding kid into the signature adds nothing here (a relabel to a known key already fails verification; strip / unknown-relabel fail-open regardless). The anchor is the authoritative seal, so that is where attribution is bound. Adds 3 regression tests (v3 tip moves on kid/sig change; v3 verify catches the strip; legacy v2 stays hash-only). Updates docs/AUDIT_ATTESTATION.md + CHANGELOG. 1945 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
|
✅ Docker image built successfully
|
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.
Description
The deferred finding from the deep adversarial pass (complements #175). The audit attribution layer had one unguarded move: a writer-only attacker — no private key, no anchor key — could strip or rewrite
kid/sigon an entry that was already signed AND anchored, and every layer still reported green:kid/sig, so it stays intact;verifyAuditSignaturesjust re-counts the entry asunsigned→ fail-open;hash, so the sealed tip was byte-identical.Net: the author of a sealed
prod-writerecord could be silently erased or re-tagged.Type of Change
Changes Made
computeAnchorTipV3chains the HMAC overhash | kid | sigper line (unit-separated; own domain seedkit-audit-anchor/v3). Anchor records are written atversion: 3.tip-mismatch. Forging akid/sigonto a sealed keyless entry is caught the same way (keyless seals with empty attribution).verifyAgainstAnchorpicks the fold algorithm from the record'sversion, so legacyv ≤ 2anchors keep verifying hash-only until the nextkit audit anchorre-seals them as v3.hashalone. Bindingkidinto the signature adds nothing for this threat — a relabel to a known key already fails verification, and strip / unknown-relabel fail-open regardless. The anchor is the authoritative seal, so that's where attribution is bound. (Rationale in the commit body.)docs/AUDIT_ATTESTATION.md(retracts the gap, documents v3) + CHANGELOG.Testing
Test Coverage
audit-anchor.test.ts)npm test) — 1945 pass, 0 failManual Testing
computeAnchorTipV3moves whenkid/sigchange; the legacy hash-only tip does not (documents the exact gap).tip-mismatchafter a sealed entry'skidis stripped;anchored-okfor the untampered log.🤖 Generated with Claude Code
https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
Generated by Claude Code