Skip to content

fix(verify)!: issuer key authorization before the signature, and no VALID without a policy - #494

Merged
imran-siddique merged 4 commits into
mainfrom
fix/issuer-authorization-5-3-3
Oct 15, 2026
Merged

imran-siddique merged 4 commits into
mainfrom
fix/issuer-authorization-5-3-3

Conversation

@imran-siddique

Copy link
Copy Markdown
Member

Spec §5.3.3 says a verifier MUST NOT return VALID unless the signing key is authorized for the manifest's declared issuer, MUST complete that before verifying the signature, and MUST tell an authorization failure apart from authorization that cannot be determined. The SDK missed two of those. @litzki-systems found both while writing the issuer key authorization guide in #493.

trusted_key_issuers=None. _signature_key_issuer_mismatch returned early, so trusted keys alone reached VALID. Now the signature is not verified and the result is UNVERIFIABLE, with a warning naming §5.3.3. A key the policy does not authorize stays MISMATCH, so the two conditions stay distinct.

Order on v0.2. The COSE envelope signature was verified first and issuer authorization ran afterwards. _authorize_before_signature now decodes the envelope (steps 1 to 4, no signature), resolves each kid against trusted_keys, and authorizes it before step 5. An unauthorized key is refused unchecked: AM-VEC-COSE-009 now records signature_verified: false. signature_valid stays true, because the bytes are sound.

Knock-on changes:

  • manifest verify --authorized-issuer (repeatable). Without it the CLI result is UNVERIFIABLE.
  • Every vector context that expects a verified signature carries trusted_key_issuers. New AM-VEC-025 (v0.1) and AM-VEC-COSE-016 (v0.2) pin the no-policy case.
  • A v0.1 manifest without issuer can no longer reach VALID, since there is no issuer to authorize the key for.
  • Getting-started, CI/CD signing, server-side verification and the API reference pass the policy. Version 0.16.0, not tagged.

This is breaking for any caller that sets trusted_keys without trusted_key_issuers. That includes cMCP, which passes no policy today: its main fails 23 tests against this branch. The cMCP PR for that is agentrust-io/cmcp#743, and it has to land before cMCP moves its pin off agent-manifest==0.15.0.

Evidence: 2306 passed, 20 skipped (2292 before); ruff and mypy clean. Eight new tests, the two new vectors and the changed AM-VEC-COSE-009, eleven checks in all, fail with _verify.py and cli.py restored from bd37750. A signature-call spy shows no Ed25519 verification on the refused paths.

Once this merges, the "known divergence" note in #493's guide is stale and comes out.

🤖 Generated with Claude Code

Comment thread docs/api-reference/cli.md Resolved

@rajnisht7 rajnisht7 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.

also there is no warning at verify_cose_manifest(), as it returns as verified=True even on wrong issuer

@litzki-systems

Copy link
Copy Markdown
Contributor

Thanks @imran-siddique for folding the guide into this PR, that saves a separate follow-up. I checked the page at 1e8872d against _verify.py. Four spots still describe the 0.15.0 behaviour:

  1. "Where the check runs", diagram. The flow has no step for a missing policy. Between key resolution and the authorization check:
   no trusted_key_issuers ──> UNVERIFIABLE, signature not verified
  1. "Read the mismatch details". Add: "A missing policy produces no mismatch detail. It appears as UNVERIFIABLE with a warning in result.warnings that names §5.3.3."
  2. Same section, last paragraph. Replace "The 'no issuer' row above still applies to v0.1 manifests" with: "A v0.1 manifest without issuer still passes schema validation, but it can never reach VALID. With a policy it yields the 'no issuer' row above; without one, UNVERIFIABLE."
  3. Related → Key rotation. The policy is no longer optional, so: "add a new key to trusted_key_issuers together with trusted_keys, or manifests signed with the new key fail authorization."

Optional, for people upgrading: a box under "Applies to SDK 0.16.0", plus the CLI flag next to the Python example:

!!! warning "Breaking change in SDK 0.16.0"
    Up to SDK 0.15.0, a verifier that set `trusted_keys` without `trusted_key_issuers` skipped issuer authorization and could return `VALID`. From 0.16.0 the same configuration returns `UNVERIFIABLE`. If you upgrade, add `trusted_key_issuers` first.
manifest verify signed.json --public-key pub.hex \
  --authorized-issuer spiffe://trust.example/issuer/prod

+1 to both points from @rajnisht7. The missing backslashes come from the verify docstring in cli.py, so the fix belongs there and cli.md follows; the --public-key line already lacked one before this PR. For verify_cose_manifest(), one docstring line would close the gap the guide already names: "Does not check issuer key authorization (spec §5.3.3). Use verify_manifest() for a complete verification."

@carloshvp carloshvp 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.

Reviewed 1e8872d in an isolated Python 3.12 checkout. The issuer-authorization change behaves as intended: neither a missing policy nor an empty/unauthorized policy permits VALID, and the v0.1/COSE rejection paths leave signatures unverified. The COSE ordering and every-signer authorization checks agree with spec section 5.3.3.

Required repository correction, separate from the implementation: commit 142d338 has no Signed-off-by trailer. CONTRIBUTING.md requires sign-off on every commit; sign-offs on the merge and later documentation commit do not cover this first commit. Please add the missing DCO sign-off before approval.

Validation: the complete SDK suite passed (2316 passed, 10 skipped, 19 subtests passed); Ruff, mypy, Bandit and the locked-dependency audit passed. The normal docs build and built-asset link check passed, with eight changelog cross-reference warnings. Cross-repository validation also passed: cMCP #743 at 8fd3c150a86f2f387ff6ad80090c846324517994 ran its full CI test selection against this SDK head with 2446 passed and 29 skipped. These results do not claim execution of skipped optional/native fixtures.

Non-blocking cleanup: I agree with the existing CLI continuation and issuer-guide comments. Also, git diff --check reports five added CRLF lines in python/tests/vectors/AM-VEC-021.json:77-81; please normalize the touched vector formatting while updating the PR. I found no new blocking defect in the authorization implementation.

The cMCP issuer-policy change still needs to land before cMCP advances its locked SDK dependency to 0.16.0; publishing or merging either repository was outside this review. Requesting changes for the missing required DCO sign-off.

imran-siddique and others added 2 commits October 13, 2026 11:17
…ALID without a policy

Spec 5.3.3 requires key resolution and issuer authorization to complete
before the signature is verified, and forbids VALID when authorization
cannot be determined. The SDK diverged from both, as litzki-systems found
writing the issuer key authorization guide (#493):

- trusted_key_issuers=None skipped the check, so a manifest could reach
  VALID with no issuer authorization. It now leaves the signature
  unverified and returns UNVERIFIABLE with a warning naming 5.3.3,
  distinct from the MISMATCH of a failed check.
- On the v0.2 COSE path the envelope signature was verified before issuer
  authorization. Keys are now resolved and authorized from the decoded
  envelope first; an unauthorized key is refused unchecked
  (AM-VEC-COSE-009 now records signature_verified false).

manifest verify gains --authorized-issuer. Every vector context that
expects a verified signature carries trusted_key_issuers; AM-VEC-025 and
AM-VEC-COSE-016 pin the no-policy case. A v0.1 manifest without issuer can
no longer reach VALID. The issuer guide follows the 0.16.0 behaviour.
Version 0.16.0, not tagged.

BREAKING CHANGE: callers that pass trusted_keys without trusted_key_issuers
now get UNVERIFIABLE instead of VALID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Imran Siddique <45405841+imran-siddique@users.noreply.github.com>
The issuer guide gains the missing-policy step in its flow, the
UNVERIFIABLE warning, the v0.1 no-issuer outcome, an upgrade box for
0.16.0 and the --authorized-issuer CLI form. The verify docstring's
multi-line example carries its continuation backslashes, and cli.md is
regenerated from it. verify_cose_manifest() states that it does not
check issuer key authorization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Imran Siddique <45405841+imran-siddique@users.noreply.github.com>
@imran-siddique
imran-siddique force-pushed the fix/issuer-authorization-5-3-3 branch from 1e8872d to f78ff22 Compare October 13, 2026 18:34
@imran-siddique

Copy link
Copy Markdown
Member Author

Rebuilt on current main as two signed commits, 06618164 (the change, unchanged in content) and f78ff229 (review fixes):

  • @litzki-systems all four guide spots, the 0.16.0 upgrade box and the --authorized-issuer CLI form are in.
  • @rajnisht7 the verify docstring carries its continuation backslashes and cli.md is regenerated from it. verify_cose_manifest() now says it does not check issuer key authorization and points to verify_manifest().
  • @carloshvp AM-VEC-021.json is CRLF on all 83 lines on main, so the five added lines match the file. Normalising it is a whole-file change and belongs with a .gitattributes rule, not here.

Could you re-review by Oct 16?

@litzki-systems

Copy link
Copy Markdown
Contributor

Re-checked the guide at f78ff22: all four spots, the 0.16.0 upgrade box, the --authorized-issuer CLI form and the verify_cose_manifest() docstring line are in, and they match _verify.py, _cose.py and cli.py on this branch.

One sentence is now out of date. Under "Gate on the result, not on signature_verified", the guide still says:

signature_verified does not tell you whether authorization passed

Since 0.16.0, verify_manifest() checks the signature only after authorization passes, so the table below shows false in every row. Suggested replacement:

In the result of verify_manifest(), signature_verified is true only when authorization passed and the signature checked out. It still does not mean VALID: other checks can produce MISMATCH, as AM-VEC-002 shows for a changed system prompt hash.

I reviewed the guide only, not the implementation.

… 0.16.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Imran Siddique <45405841+imran-siddique@users.noreply.github.com>
@imran-siddique

Copy link
Copy Markdown
Member Author

@litzki-systems applied as written in bf21623f; AM-VEC-002 on this branch expects exactly that MISMATCH with signature_verified: true.

carloshvp
carloshvp previously approved these changes Oct 14, 2026

@carloshvp carloshvp 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.

Re-reviewed bf21623. The required DCO correction is complete: every commit in the replacement PR range carries Signed-off-by. The issuer guide, generated CLI continuations and low-level COSE API caveat now agree with the implementation.

Issuer authorization remains fail closed and precedes signature verification. An independent 17-case matrix with signature-verification spies confirmed missing policy gives UNVERIFIABLE, empty/unauthorized grants give MISMATCH, and refused paths make no cryptographic verification call. Authorized v0.1, COSE and real Ed25519/ML-DSA hybrid controls reach VALID; a hybrid with either signer unauthorized is refused before signature verification.

Validation on isolated Python 3.12: the complete SDK suite passed with 2405 passed, 10 skipped and 27 subtests passed, with 91.53% coverage. CI-equivalent Ruff, mypy, Bandit and locked-dependency audit passed. The normal docs build and built-asset checks passed; the same eight changelog cross-reference warnings reproduce on current main. Merge simulation against current main was clean. Cross-repository cMCP #743 at 283352cee6d5c7ede57d43ae7d26a56de1ac0d2e passed its complete CI selection against this SDK head: 2470 passed, 29 skipped. Skipped optional/native fixtures are not claimed as executed.

The five added CRLF lines in AM-VEC-021.json preserve the existing file convention: main has 83/83 CRLF lines and this head has 88/88. The CR-at-EOL-aware diff check is clean, so I am not treating whole-file line-ending normalization as an approval requirement.

Approving this head. cMCP's issuer-policy integration must land before its locked SDK dependency advances to 0.16.0; its unused signature-only helper also needs the documented migration follow-up.

rajnisht7
rajnisht7 previously approved these changes Oct 14, 2026

@rajnisht7 rajnisht7 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.

Reviewed head bf21623, §5.3.3 correctly enforced on both envelopes, authorization before signature, missing policy -> UNVERIFIABLE, unauthorized key -> MISMATCH. CLI, vectors, and docs look good

Resolves the CHANGELOG.md conflict with #498 by keeping both entries under Changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Imran Siddique <45405841+imran-siddique@users.noreply.github.com>
@imran-siddique
imran-siddique dismissed stale reviews from rajnisht7 and carloshvp via d260fb5 October 14, 2026 23:39

@carloshvp carloshvp 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.

Re-reviewed exact head d260fb50205b5db79cc24cb81e0b89331862326b after the merge from main dismissed the earlier approvals. The merge adds main's documentation/spec updates; python/ and scripts/ are byte-unchanged from the previously approved bf21623f896c4ca1b8bec7e55a807331f10fbfa0. I checked the changelog conflict resolution and both entries remain. All four commits in the PR range carry Signed-off-by.

Fresh isolated Python 3.12 validation: the complete SDK suite passed with 2405 passed, 10 skipped and 27 subtests passed, with 91.53% coverage. The independent 17-case signature-spy matrix passed again for v0.1, COSE Sign1 and real Ed25519/ML-DSA hybrid envelopes: missing policy gives UNVERIFIABLE, empty/unauthorized grants give MISMATCH, refused paths make no signature-verification call, and every hybrid signer must be authorized before verification. Authorized controls reach VALID.

CI-equivalent Ruff, strict mypy, Bandit and the locked-dependency audit passed. The docs build and built-asset reference check passed; the same eight changelog cross-reference warnings reproduce on current main. The CR-at-EOL-aware diff check and merge simulation are clean. The skipped cases include unavailable AGT/native-hardware fixtures and are not claimed as executed.

The CLI example now includes both continuation backslashes in the source docstring and generated reference, so I resolved the addressed outdated thread. The companion cMCP issuer-policy integration #743 is now merged; cMCP must retain that integration when advancing its SDK pin to 0.16.0.

Approving this current head. I found no new blocking defect in the merge or the issuer-authorization implementation. All hosted checks were successful at the final refresh.

@rajnisht7 rajnisht7 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.

Re-Reviewed head d260fb5, the changes looks good

@imran-siddique
imran-siddique merged commit b6d2311 into main Oct 15, 2026
19 checks passed
@imran-siddique
imran-siddique deleted the fix/issuer-authorization-5-3-3 branch October 15, 2026 00:48
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.

4 participants