fix(security): recheck the evidence chain before TRACE signing, add ClusterFuzzLite - #65
Merged
Merged
Conversation
…lusterFuzzLite finalize_trace took runtime.measurement from snapshot.chain_digest and derived the appraisal from snapshot.entries without checking that the entries still hash to that digest. A deny edited to allow after sealing was signed as an affirming record. Both SDKs now recompute the chain and refuse on mismatch; a malformed event in a consistent chain is a TraceFinalizationError rather than a KeyError. SchemaValidator.validate let RecursionError (deep or cyclic input) and AttributeError (non-string keys) escape, and accepted NaN and Infinity. All three are EventValidationError now. The AGT adapters raised TypeError on a list or object in a decision, kind, outcome or classification field, and OverflowError on a huge latency_ms. Both are ValueError now. Adds ClusterFuzzLite (Scorecard FuzzingID) with three targets over event validation and projection, the OPA and AGT policy adapters, and TRACE finalization, built from the hash-pinned test lock. Co-Authored-By: Claude Opus 5.5 <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.
finalize_tracetookruntime.measurementfromsnapshot.chain_digestand derived the appraisal fromsnapshot.entries, and never checked that one still hashes to the other.EvidenceSnapshotis a public dataclass holding mutable dicts. Seal a run holding a deny, setentries[0].event["decision"] = "allow", and the old code signed an affirming record under a measurement that commits to the deny.Fixes:
trace_adapter.pyandtrace-finalizer.tsrecompute the chain (sequence, previous digest, entry digest, event_id, run_id, chain_digest) and refuse on mismatch. A malformed event in a consistent chain is nowTraceFinalizationError, notKeyError. TS shares the digest through a new internalevidence-digest.ts, not re-exported. Four Python tests intest_trace_adapter_refusals.py, one TS test.validation.py: 5,000-deep nesting raisedRecursionError, a non-string key raisedAttributeError, and NaN or Infinity passed. All three are nowEventValidationError, with depth capped at 32.test_evidence.pyexpected NaN to fail at the chain; it now fails one step earlier, which matches ajv on the TS side.adapters/agt.py,agt_audit.py,agt_approval.py,agt_data.py: a list or object where a decision, kind, outcome or classification belongs raisedTypeError: unhashable type;latency_ms=1e303raisedOverflowError. Both areValueErrornow. The fuzzer found the first on its first run.Scorecard FuzzingID (#19):
.clusterfuzzlite/with three targets (event validation and every projection plus inbound propagation headers; OPA and AGT policy adapters; sealed evidence to signed TRACE, including a post-seal edit that must be refused). Build installs fromrequirements/test.txtwith--require-hashes. Actions are pinned to the SHAs agent-manifest uses, address sanitizer only, 45 minute jobs.SAST #22:
codeql.ymlalready runs on push to main and every pull request with no path filter, so this clears as new commits are scanned.Verified: 128 Python tests pass, 2 skipped (was 114); TS
npm run check42 pass; schema, version, OTel and TS schema gates pass; wheel and sdist smoke pass; actionlint clean. Atheris will not build on Windows, so each target ran 4,000 inputs through a stand-in provider, and each was bundled with PyInstaller using thebuild.shflags and run. That bundle run found the missing--collect-data=agentrust_trace. With the chain check disabled, the TRACE target caught the edited entry on 38 of 38 signed runs.Generated with Claude Code