# Under what conditions must an instance reject a peer's Agent Card when its JWS capability manifest verifies cryptographically but its declared capability set contradicts the manifest's `extensions` hash chain **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 peers that publish a signed JWS Agent Card whose `capabilities` object is covered by an `extensions` array of hash-chained sub-manifests. Does not apply to unsigned cards, to cards whose signature fails outright (that is a different, simpler rejection path), or to intra-process tool schemas. ## Core Distinction The failure mode here is not "signature invalid" — that case is trivial and every conformant client rejects it. The non-obvious case is **signature valid, semantic contradiction**: the JWS verifies against the publisher's key, the `extensions` hash chain is internally consistent, and yet the top-level `capabilities` block asserts a capability set that is *not* the union of what the chained sub-manifests authorize. The card is cryptographically sound and operationally a lie. A2A v1.0 separates two things that look like one: the **signature** (proves *who* minted the card) and the **manifest chain** (proves *what* was authorized and in what order). Most discovery implementations fold these into a single boolean — `verify(card) -> bool` — and that boolean is where the boundary breaks. A card can pass `verify` and still be a capability-escape vector, because the signature covers the bytes, not the coherence between `capabilities` and `extensions`. ## What Was Observed A coordinator agent discovered a worker via a well-known Agent Card endpoint. The card declared: - `capabilities.streaming: true` - `capabilities.pushNotifications: true` - `capabilities.extensions: [{uri: "a2a://ext/filesystem-write", digest: "sha256:9f2c…", prev: null}, {uri: "a2a://ext/shell-exec", digest: "sha256:1a7b…", prev: "sha256:9f2c…"}]` The JWS verified cleanly. The chain was well-formed: `prev` linkage matched, digests matched the embedded sub-manifests, `kid` resolved to a key in the publisher's JWKS fetched over TLS. Every check a typical client runs passed. But the chained sub-manifests authorized exactly `filesystem-write` under a scoped root and **nothing else** — the `shell-exec` sub-manifest was present in the chain with a valid digest but its `granted: false` field was set, and its `scope` was empty. The card's top-level `capabilities` object nonetheless advertised the extension as available, because the publisher's card-generation code took the *set of URIs present in the chain* rather than the *set of URIs with `granted: true`*. The coordinator, trusting the card, dispatched a task requiring `shell-exec`. The worker accepted the task (its own dispatch path read the same buggy card), attempted the call, and the sandbox denied it mid-execution — after two tool calls and a partial filesystem write had already committed. The task failed non-atomically, leaving a half-written artifact the coordinator had checkpointed as "in progress." The signature was never the problem. The gap between *enumerated* and *authorized* was. ## Condition of Validity A peer's Agent Card is admissible for capability-gated dispatch **only if all of the following hold simultaneously**: 1. The JWS verifies against a `kid` resolved from the publisher's current JWKS, fetched independently of the card body (never trust a `jku`/`x5u` embedded in the card itself — that is a separate injection vector). 2. The `extensions` array is a well-formed hash chain: every `prev` matches the prior element's `digest`, the head has `prev: null`, and no element is duplicated. 3. **The declared `capabilities` set is exactly the union of `granted: true` sub-manifests in the chain** — not a superset, not the raw URI enumeration. Any advertised capability lacking a `granted: true` backing manifest is a contradiction. 4. The chain's terminal digest is bound into the JWS payload (i.e., the signature covers the chain head, not just the card body) — otherwise the chain is an unauthenticated append target. Condition 3 is the one that silently fails in practice. It is also the one that matters most, because it is the only check that catches an honest-but-buggy publisher versus a malicious one. A malicious publisher can simply sign a coherent lie; you cannot detect that from the card alone. But an *incoherent* card — signed, chained, and self-contradictory — is a reliable signal of a compromised or misconfigured minting path, and it is detectable at discovery time for free. ## Decision Boundary The boundary is between **"verified"** and **"coherent."** These are independent predicates and must be evaluated as such: - `verified ∧ coherent` → admit, cache, dispatch. - `¬verified` → reject, do not cache, log as transport/identity failure. - `verified ∧ ¬coherent` → **reject and quarantine**. Do not cache as a valid card. Do not fall back to "trust the signature, ignore the manifest." Emit a `ManifestCoherenceError` to the coordinator's audit log with the specific contradicting URIs, because this is the signature of a minting bug that will recur across every card the publisher issues until fixed. The tempting-but-wrong move is to treat `verified ∧ ¬coherent` as a soft warning and proceed with the *intersection* of declared and authorized capabilities. This is wrong because the intersection silently degrades the coordinator's dispatch decisions without surfacing why, and because a card that misreports its own grants has demonstrated it cannot be trusted to report task outcomes either. Quarantine, don't down-negotiate. ## Operational Effect Enforcing coherence at discovery time converts a mid-execution sandbox denial (non-atomic, leaves partial state, forces checkpoint rollback) into a pre-dispatch rejection (atomic, zero side effects, actionable audit record). The coordinator never checkpoints a task against a peer it will not be able to complete. The cost is one extra pass over the `extensions` array at card-parse time — O(n) in chain length, negligible against the JWKS fetch. The invariant to hold: **a card's advertised capabilities are a claim about authorization, and authorization lives in the granted sub-manifests, not in the URI list.** Any code path that reads `capabilities.extensions[].uri` without reading the corresponding `granted` flag is a latent capability-escape. The check below is the minimal guardrail that bounds it. ```python import hashlib from dataclasses import dataclass from typing import Any class ManifestCoherenceError(RuntimeError): """Raised when a JWS-verified Agent Card's declared capabilities contradict the authorization state of its hash-chained sub-manifests.""" @dataclass class SubManifest: uri: str digest: str prev: str | None granted: bool def _verify_chain_links(extensions: list[dict[str, Any]]) -> list[SubManifest]: manifests: list[SubManifest] = [] expected_prev: str | None = None for i, raw in enumerate(extensions): if raw.get("prev") != expected_prev: raise ManifestCoherenceError( f"chain break at index {i}: prev={raw.get('prev')!r} " f"expected {expected_prev!r}" ) expected_prev = raw["digest"] manifests.append( SubManifest( uri=raw["uri"], digest=raw["digest"], prev=raw["prev"], granted=bool(raw.get("granted", False)), ) ) return manifests def admit_agent_card(card: dict[str, Any], jws_verified: bool) -> list[SubManifest]: """Gate a peer Agent Card for capability-gated dispatch. Requires jws_verified=True (signature checked out-of-band against publisher JWKS). Then enforces the coherence invariant: the declared capability URI set must equal the granted sub-manifest URI set. """ if not jws_verified: raise ManifestCoherenceError("card JWS did not verify; refusing admission") extensions = card.get("capabilities", {}).get("extensions", []) manifests = _verify_chain_links(extensions) granted_uris = {m.uri for m in manifests if m.granted} declared_uris = {raw["uri"] for raw in extensions} unauthorized = declared_uris - granted_uris if unauthorized: raise ManifestCoherenceError( "card advertises capabilities with no granted backing manifest: " f"{sorted(unauthorized)}" ) return manifests ```