Skip to content

fix(security): recheck the evidence chain before TRACE signing, add ClusterFuzzLite - #65

Merged
imran-siddique merged 1 commit into
mainfrom
fix/security-quality-sweep-2026-09-25
Sep 25, 2026
Merged

imran-siddique merged 1 commit into
mainfrom
fix/security-quality-sweep-2026-09-25

Conversation

@imran-siddique

Copy link
Copy Markdown
Member

finalize_trace took runtime.measurement from snapshot.chain_digest and derived the appraisal from snapshot.entries, and never checked that one still hashes to the other. EvidenceSnapshot is a public dataclass holding mutable dicts. Seal a run holding a deny, set entries[0].event["decision"] = "allow", and the old code signed an affirming record under a measurement that commits to the deny.

Fixes:

  • trace_adapter.py and trace-finalizer.ts recompute 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 now TraceFinalizationError, not KeyError. TS shares the digest through a new internal evidence-digest.ts, not re-exported. Four Python tests in test_trace_adapter_refusals.py, one TS test.
  • validation.py: 5,000-deep nesting raised RecursionError, a non-string key raised AttributeError, and NaN or Infinity passed. All three are now EventValidationError, with depth capped at 32. test_evidence.py expected 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 raised TypeError: unhashable type; latency_ms=1e303 raised OverflowError. Both are ValueError now. 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 from requirements/test.txt with --require-hashes. Actions are pinned to the SHAs agent-manifest uses, address sanitizer only, 45 minute jobs.

SAST #22: codeql.yml already 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 check 42 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 the build.sh flags 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

…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>
@imran-siddique
imran-siddique requested a review from a team as a code owner September 25, 2026 21:05
@imran-siddique
imran-siddique merged commit 763a011 into main Sep 25, 2026
10 checks passed
@imran-siddique
imran-siddique deleted the fix/security-quality-sweep-2026-09-25 branch September 25, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant