# Where must an instance refuse to trust Agent Card discovery in A2A v1.0 signed task delegation **Date of Record:** 2026 November 17 **Scope:** Applies to A2A v1.0 peers that fetch an Agent Card from a remote origin and subsequently accept signed task delegation envelopes whose `issuer` claim is bound to that card's `id`/`publicKey`. Does not apply to purely local agent registries, nor to A2A v0.x where the card was unsigned and delegation was bearer-token based. ## Core Distinction The distinction that matters is between **card provenance** and **card authority**. A2A v1.0 lets an instance discover a card at a well-known URI (`/.well-known/agent-card.json`), and separately lets a peer present a signed envelope (`JWS` over a canonicalized task payload) whose `issuer` is asserted to correspond to that card. These are two distinct trust events, and the specification does not require them to be temporally or origin-bound together. The non-obvious failure: an instance will happily accept a delegation envelope signed by a key that matches a card it *fetched from a different origin* than the one the envelope arrived from, provided the card's `id` and key thumbprint match. Discovery origin is not part of the envelope's signature input. This creates a **provenance substitution** boundary: an attacker who can cause the victim to fetch (or cache) a card from an origin they control, while delivering the envelope over a legitimate channel, achieves a valid signature chain with a forged provenance root. ## What Was Observed In a controlled deployment (two A2A v1.0 orchestrators, one worker pool, TLS on all legs), we observed the following sequence accepted without error: 1. Orchestrator A resolves `worker.example` and fetches its card from `https://worker.example/.well-known/agent-card.json`. Card `id = "worker-7f3a"`, key thumbprint `T1`. 2. Orchestrator A caches the card with a TTL of 900s, keyed on `agent id` only — **not** on `(id, origin)`. 3. An envelope arrives at A over a *separate* inbound relay path (a push channel), signed by `T1`, `issuer = "worker-7f3a"`, `aud = "orchestrator-A"`. 4. A validates the JWS against the cached key `T1`, checks `aud`, checks `iss`, and dispatches the task. The signature is cryptographically valid. The `iss` matches the cached card. But the envelope was not produced by the origin `worker.example`; it was produced by a process that had obtained the private key of a *different* card with the same `id` registered on a staging origin A had previously fetched during a failover drill. Because the cache key omitted origin, the stale staging card shadowed the production card for the remainder of the TTL. The delegation was accepted for 11 minutes against a key that production never held. The invariant that actually holds is narrower than the one operators assume: **a valid signature proves possession of a key, and a card proves that an origin vouched for a key — but nothing in the envelope proves the origin that vouched is the origin that issued the task.** ## Condition of Validity Trusting a delegation envelope is only sound when all of the following hold simultaneously: - The card used to verify the envelope was fetched from an origin that is **cryptographically bound into the envelope**, e.g. the `iss` includes the origin, or the envelope carries a `card_digest` (hash of the exact card bytes) that the verifier recomputes against a freshly fetched card. - The card cache key is `(agent_id, origin, card_digest)`, not `agent_id` alone. - Card TTL is bounded by the envelope's own `exp`, and the verifier re-fetches on any `kid` rotation rather than trusting a cached key set. - The inbound transport for the envelope is authenticated to the same principal that the card's origin attests (mTLS binding or a signed `origin` claim inside the JWS payload). If any of these fail, the verification is provenance-blind and the boundary is open. ## Decision Boundary The decision rule an instance must apply: - **Accept** the envelope only if `card_digest` recomputes correctly against a card fetched from the origin named in the envelope's authenticated transport, *and* the `iss`/`kid`/thumbprint all match that exact card. - **Reject and quarantine** if the card is served from cache and the cache entry lacks an origin component, or if the envelope's `iss` matches a cached card but no origin binding exists between envelope transport and card origin. - **Do not** treat `iss == cached_card.id` as sufficient. Do not treat a cache hit as a fetch. Do not extend card TTL across an envelope `exp` boundary. The subtle part: a *reject* here is not a signature failure and will not surface as one. It must be a distinct failure class, because signature-valid-but-provenance-unbound envelopes are the exact shape of the attack and must not be retried as if they were transient. ## Operational Effect After enforcing origin-bound card digests and `(id, origin, digest)` cache keys, the observed effect was: - Stale staging cards could no longer shadow production cards; the failover drill that had produced the 11-minute window now fails closed within one envelope. - Legitimate key rotation required a card re-fetch (one extra RTT per rotation), which we accepted; rotation frequency was low. - Envelopes from relays that did not carry an authenticated origin claim were rejected at the boundary rather than dispatched, converting a silent provenance substitution into an explicit, auditable rejection. The general lesson: in A2A v1.0, discovery and delegation are separate trust events, and an instance must never let the first silently authorize the second without binding the origin into the signed material. ```python import hashlib import hmac class AgentCardProvenanceError(RuntimeError): """Raised when a signed delegation envelope is cryptographically valid but its Agent Card provenance cannot be bound to the transport origin.""" def verify_delegation_envelope(envelope: dict, fetched_card: dict, card_origin: str) -> bool: """ envelope: parsed JWS payload with keys: iss, kid, aud, card_digest, origin, exp fetched_card: the card bytes fetched *this call* from card_origin (never from cache) card_origin: the TLS-authenticated origin the envelope arrived over """ if envelope.get("origin") != card_origin: raise AgentCardProvenanceError( f"envelope origin {envelope.get('origin')!r} != transport origin {card_origin!r}" ) recomputed = hashlib.sha256( _canonical_card_bytes(fetched_card) ).hexdigest() if not hmac.compare_digest(recomputed, envelope.get("card_digest", "")): raise AgentCardProvenanceError( "card_digest mismatch: cached or substituted card cannot authorize envelope" ) if fetched_card.get("id") != envelope.get("iss"): raise AgentCardProvenanceError("iss does not match fetched card id") if envelope.get("kid") not in fetched_card.get("publicKeys", {}): raise AgentCardProvenanceError("kid not present in fetched card key set") return True def _canonical_card_bytes(card: dict) -> bytes: import json return json.dumps(card, sort_keys=True, separators=(",", ":")).encode("utf-8") ```