Skip to content

fix(security): enforce schema conformance during verification - #156

Merged
imran-siddique merged 2 commits into
mainfrom
agent/verify-schema-conformance
Aug 11, 2026
Merged

fix(security): enforce schema conformance during verification#156
imran-siddique merged 2 commits into
mainfrom
agent/verify-schema-conformance

Conversation

@imran-siddique

Copy link
Copy Markdown
Member

Why

A valid signature authenticates bytes; it does not make unknown fields, missing required claims, or invalid enum values part of TRACE. verify_record() previously checked selected fields and the signature without enforcing the canonical v0.2 schema, creating separate notions of schema-valid and signature-valid records.

What changed

  • validate the complete signed object against the packaged canonical v0.2 schema during verify_record()
  • preserve the existing specific errors for missing and malformed signatures
  • surface schema failures as ValueError with the failing field path
  • document built-in schema validation in the verification guide and tutorial
  • correct the stale v0.1 docstring in validate_json()
  • reconcile an existing schema/model contradiction by making transparency optional for unanchored Level 0/1 records, as the model, conformance levels, and documentation already require

Verification

  • focused sign/schema/adapter tests: 112 passed
  • full suite: 326 passed, 1 skipped
  • ruff check src tests
  • mypy src/agentrust_trace
  • git diff --check

New regressions cover correctly signed records with an unknown top-level field, a missing required claim, and an invalid nested enforcement mode.

@imran-siddique
imran-siddique marked this pull request as ready for review August 11, 2026 15:37
# Conflicts:
#	docs/tutorials/verifying-a-trust-record.md
@imran-siddique
imran-siddique merged commit 84999e7 into main Aug 11, 2026
5 checks passed
@imran-siddique
imran-siddique deleted the agent/verify-schema-conformance branch August 11, 2026 15:44
imran-siddique added a commit that referenced this pull request Aug 11, 2026
… absence first

Schema enforcement (#156) refuses a record with no cnf before the
cnf-to-trusted-key binding is reached, so the message changed while the
rejection did not. The binding is still covered by the two tests where cnf
is present and names the wrong key.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
imran-siddique added a commit that referenced this pull request Aug 11, 2026
* fix: bind cnf to trusted signing key

* test: assert on cnf rather than the exact message, now schema catches absence first

Schema enforcement (#156) refuses a record with no cnf before the
cnf-to-trusted-key binding is reached, so the message changed while the
rejection did not. The binding is still covered by the two tests where cnf
is present and names the wrong key.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
lywinged added a commit to lywinged/trace-spec that referenced this pull request Aug 24, 2026
…y set here

A vector set is a claim that an implementation which does not do the thing will
fail it, and nothing in a set's own tests checks that claim: they run this verifier
and compare verdicts, so they pass whether or not any other implementation could
pass too.

Two criteria are decidable from the fixtures and are implemented: no set may be
satisfied by an unconditional answer in either direction, and margin is counted per
declared boundary rather than per failure code. The second was written the wrong way
round first, and the set that caught it was the one that had done it right.

Applied to all three sets, ours included, with the shortfalls recorded exactly so
they can neither widen nor be forgotten. verifier-compatibility separates 3 of its 8
vectors: since agentrust-io#156 made verify_record validate against a schema pinning eat_profile
with a const, five of its refusal vectors are refused by the schema whether or not a
verifier implements a single profile rule. The set was separating when written and no
vector was edited. Verdict stability is not coverage stability.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Louielunz <48041247+lywinged@users.noreply.github.com>
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