Skip to content

examples: add signature-vs-execution verification boundary example (#506) - #509

Merged
imran-siddique merged 2 commits into
agentrust-io:mainfrom
drk-ram:drk-ram-examples-signature-execution-boundary
Oct 14, 2026
Merged

imran-siddique merged 2 commits into
agentrust-io:mainfrom
drk-ram:drk-ram-examples-signature-execution-boundary

Conversation

@drk-ram

@drk-ram drk-ram commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

What this changes

Closes #506.

Adds an executable, synthetic example under examples/signature-execution-boundary/ and automated checks in tests/test_signature_execution_boundary.py demonstrating the boundary between a valid Ed25519 signature and verified execution in TRACE v0.2, building on docs/quickstart.md, docs/tutorials/verifying-a-trust-record.md, and LIMITATIONS.md.

Run python examples/signature-execution-boundary/signature_execution_boundary.py --out DIR to generate deterministic UTF-8/LF JSON artifacts (baseline-record.trace.json, invented-execution-record.trace.json, and verification-inputs.json) and execute four boundary checks:

  1. Valid signature against a separately retained trusted key: verify_record() validates baseline-record.trace.json against schema/trace-claim.json, confirms eat_profile, matches cnf.jwk to the caller's configured trusted_key thumbprint (8WEkIEIu0xGWVjA1V8weTlFmpl0D7N3EHC0yfRjfnQQ), checks freshness at now=1791936000, and returns VerificationResult with revocation.outcome == "no_check_performed" and platform_measurement.outcome == "not_attempted".
  2. Post-signing field mutation rejected: Modifying a signed field after signing (data_class in the script, and parametrized across subject, iat, data_class, model.model_id, runtime.measurement, policy.bundle_hash, policy.enforcement_mode, build_provenance.digest, appraisal.status, tool_transcript.hash, and tool_transcript.call_count in tests/test_signature_execution_boundary.py) still passes validate_json() but raises cryptography.exceptions.InvalidSignature.
  3. Wrong issuer key and cnf.jwk confirmation-key binding: Verifying against wrong_trusted_key raises ValueError (cnf.jwk thumbprint mismatch); replacing record["cnf"]["jwk"] with wrong_trusted_key without re-signing passes validate_json() and raises InvalidSignature because cnf.jwk is part of the RFC 8785 preimage; by contrast, allow_embedded_key=True emits a UserWarning and proves internal self-consistency only.
  4. Invented execution claims signed by the trusted issuer: invented-execution-record.trace.json, signed by the same trusted issuer key at the same (subject, iat) with fabricated claims (policy.enforcement_mode: "enforce", build_provenance.slsa_level: 3, appraisal.status: "affirming", and tool_transcript.call_count: 12), passes validate_json() and verify_record() with an identical VerificationResult. Only independent comparison of tool_transcript.hash against the retained external transcript separates baseline=matched from invented=mismatch and unretained=unavailable.

No specification, schema, or SDK changes.

Cold-reader review (CONTRIBUTING.md)

An independent cold-reader session reviewed the initial diff (c08974c3c0b33d9bd77bc1778b238a86f770b788..71f02fb) against CONTRIBUTING.md, docs/quickstart.md, docs/tutorials/verifying-a-trust-record.md, LIMITATIONS.md, and examples/mcp-retry/:

  • Script vs. test parity (README.md Checks 2, 3, 4): The initial signature_execution_boundary.py did not exercise allow_embedded_key=True (UserWarning) in Check 3 or None -> "unavailable" in Check 4 (both were only in tests/test_signature_execution_boundary.py), and README.md Check 2 omitted model from the list of signed claims. Updated signature_execution_boundary.py to add commitment_status() and execute both checks directly, and clarified the README.md table.
  • Canonicalization domain traversal (tuple and non-finite floats): canonical_bytes() and _commitment() initially traversed dict and list but not tuple, and test_example_numeric_domain_refuses_floats_and_unsafe_integers omitted "NaN", "Infinity", and "-Infinity". Extended both walkers to (list, tuple) and added parametrized tests for "NaN", "Infinity", "-Infinity", and tuple-nested floats/unsafe integers.
  • README stdout drift guard: Added an assertion in test_script_reproduces_fixed_evidence_bytes_and_stdout that extracts the text output block from examples/signature-execution-boundary/README.md and compares it byte-for-byte against the script's stdout.

Contributor: Raghuvar Durga (@drk-ram)

Type of change

  • Editorial (typo, link fix, clarification: no normative effect)
  • Non-breaking spec change (new optional field, new platform profile, informative addition)
  • Breaking spec change (requires 14-day comment period and Project Lead sign-off)
  • Schema change
  • Example addition

Spec section

Informative example and test suite for §3.2.2 (signature and key binding) and §3.3 (verification vs. appraisal); no normative text modified.

Tests for a fix

Not a code or schema fix.

Checklist

  • DCO sign-off on all commits (git commit -s)
  • CHANGELOG.md updated (for any normative change)
  • Breaking changes marked with <!-- CHANGED: #NNN: description --> in spec text
  • Backward compatibility statement included (for breaking changes)

…gentrust-io#506)

Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@drk-ram
drk-ram requested review from a team, lywinged and rajnisht7 as code owners October 14, 2026 05:23
…gentrust-io#506)

Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@imran-siddique imran-siddique left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally: the script prints 4 of 4 as documented and the 49 tests pass. The README's pinned commit c08974c3 predates the example; the CHANGELOG follow-up PR repins it to the merge commit.

@imran-siddique
imran-siddique merged commit 6666574 into agentrust-io:main Oct 14, 2026
14 of 15 checks passed
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.

examples: runnable boundary between a valid signature and verified execution

3 participants