Skip to content

fix(anchor): take merkle_root and leaf_count from the entry - #549

Closed
astrogilda wants to merge 2 commits into
agentrust-io:fix/464-anc-entry-bindingfrom
astrogilda-forks:fix/533-proof-only-receipt
Closed

astrogilda wants to merge 2 commits into
agentrust-io:fix/464-anc-entry-bindingfrom
astrogilda-forks:fix/533-proof-only-receipt

Conversation

@astrogilda

Copy link
Copy Markdown
Contributor

What this changes

At 95e160a, the head of #533, TR-ANC-002 refuses a receipt that carries only leaf_index and audit_path even when --entry supplies its matching registry entry. Section 5.1 of spec/registry-anchor-v1.md takes merkle_root and leaf_count from the entry, so this PR replays the proof against the entry's values.

I maintain a 27-case registry anchor corpus whose cases each name the section their expected verdict rests on. TR-ANC-002 agrees with 26 of 27 at 95e160a and 27 of 27 at 762f7b6, this PR's head.

Type of change

A conformance suite fix with no spec text change.

Spec section

None: section 6 in #533 already requires any merkle_root or leaf_count a receipt carries to equal the entry's.

Tests for a fix

test_proof_only_receipt_anchors_against_its_entry and test_proof_only_receipt_is_refused_against_another_batch fail at 95e160a. test_a_receipt_carried_leaf_count_that_is_not_an_integer_is_malformed refuses a null, string, float or boolean leaf_count, and pytest conformance/tests passes on Linux at 762f7b6.

Checklist

  • DCO sign-off on all commits (git commit -s)

Registry Anchor Format section 5 defines the inclusion proof as
leaf_index and audit_path, and the section 5.1 algorithm takes
merkle_root and leaf_count from the registry entry. TR-ANC-002 still
required both on the receipt, so a proof-only receipt with a matching
entry was refused as malformed.

TR-ANC-002 now replays the proof against the entry's root and count.
A receipt that carries its own copies must still carry the entry's
(section 6). parse_receipt keeps its contract for callers that replay
a self-contained receipt without an entry.

Signed-off-by: Sankalp Gilda <23521054+astrogilda@users.noreply.github.com>
A receipt may leave leaf_count out and take the entry's, but one that
carries the field must carry an integer. An explicit null was read as
absent and skipped the comparison with the entry.

Signed-off-by: Sankalp Gilda <23521054+astrogilda@users.noreply.github.com>
@astrogilda
astrogilda requested review from a team, lywinged and rajnisht7 as code owners October 16, 2026 20:23
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

❔ Contributor Check: UNKNOWN

Check Result
Profile UNKNOWN
Credential LOW
Overall UNKNOWN

Automated check by AgenTrust Contributor Check.

@github-actions github-actions Bot added the needs-review:UNKNOWN Contributor check flagged UNKNOWN risk label Oct 16, 2026
@imran-siddique

Copy link
Copy Markdown
Member

@astrogilda folded into #533 as 1cf5038 and 6a9d803, your authorship and sign-off kept. The one conflict was with fe5d01e: the proof now replays against the entry's root and count over the complete signed claim, so a cmcp-runtime proof-only receipt still anchors the whole envelope. The conformance suite passes on the result. Closing this one, since its commits are on the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review:UNKNOWN Contributor check flagged UNKNOWN risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants