# Where must an instance reject a signed A2A task envelope whose Agent Card `capabilities` block was re-fetched after signing **Date of Record:** 2026 November 29 **Scope:** Applies to A2A v1.0 task delegation where a delegating agent (the *caller*) signs a task envelope referencing a remote agent's Agent Card by URL and digest, and the receiving agent (the *callee*) verifies the envelope against a card it resolves at receipt time. Does not apply to in-process tool calls, MCP `tools/call` frames, or A2A envelopes that embed the full card inline rather than by reference. ## Core Distinction A2A v1.0 separates two things that look identical at the wire level: the **identity of the callee** (bound by the envelope's signature over `(issuer, callee_agent_id, card_digest, task_payload)`) and the **capabilities the callee claims** (the `capabilities` object inside the Agent Card at `/.well-known/agent.json`). The signature covers the *digest* of the card, not the card's mutable contents at verification time. The failure mode is subtle: a callee whose card has been legitimately re-published — new `capabilities.streaming`, new `defaultInputModes`, a widened `skills[]` — will still pass signature verification against a *cached* digest if the verifier resolves the card by URL and then compares digests loosely, or if it resolves the card, sees the digest matches the *envelope's* recorded digest, and proceeds to execute against the *fresh* card's capability surface. The invariant that must hold: **the capability surface used to authorize and route the task must be the exact byte sequence whose digest was signed, not whatever the callee's well-known endpoint returns at execution time.** This is not a TOCTOU on the payload — the payload is signed and immutable. It is a TOCTOU on the *authority* the caller believed it was delegating to. The caller signed "delegate to agent X, whose card hashes to `sha256:9f3a…`, which advertises `capabilities.pushNotifications: false`." If the callee now advertises `pushNotifications: true`, the caller's envelope was authorized under an assumption that no longer holds, and the callee may act on it in ways the caller's policy engine never approved. ## What Was Observed A three-agent pipeline: an orchestrator (`orch-1`) delegating summarization subtasks to a worker (`sum-7`) and a verifier (`ver-2`). `orch-1` resolves `sum-7`'s Agent Card at `https://sum-7.internal/.well-known/agent.json`, computes `sha256` over the canonicalized JSON, embeds `{card_url, card_digest}` in the envelope, signs with its Ed25519 key, and dispatches. `sum-7` receives the envelope, re-resolves its *own* card at the well-known URL, canonicalizes, hashes, and compares to `card_digest`. On match, it executes. The trigger: `sum-7` was rolled forward to a new build at 14:02 that added `capabilities.streaming: true` and a new `skills[]` entry for `long-context-summarize`. The card was re-published at 14:03. At 14:04, `orch-1` — which had cached the *old* card and its digest from 13:50 — signed a batch of 40 envelopes against the stale digest. At 14:05 `sum-7` began receiving them. Signature verification passed (the envelope's signature is over the digest, which is correct for the old card). But `sum-7`'s self-check hashed its *current* card, got a different digest, and — because the verifier was written to *log a warning and proceed* on digest mismatch when the signature itself was valid — executed all 40 tasks. The consequence was not a crash. It was a **capability-surface divergence**: `orch-1`'s policy engine had routed these tasks to `sum-7` under the assumption that `sum-7` did not support streaming, and therefore had *not* provisioned the streaming callback endpoint that `sum-7`'s new build expected. `sum-7` fell back to its default streaming sink, a shared `stdout`-adjacent channel, and 12 of the 40 partial-result frames were interleaved with an unrelated verifier's output. `ver-2` downstream received 12 malformed `TaskStatusUpdateEvent` frames and, being lenient, marked them `input-required` and re-queued — silently doubling the token cost of the batch and producing a nondeterministic ordering in the final summary. The root cause is precise: **the digest was verified against the envelope, not against the card.** The callee treated `card_digest` as an authenticated *label* rather than as an authenticated *commitment to a specific capability surface*. A digest that matches the envelope but not the card is not a valid verification — it is a verification of the wrong object. ## Condition of Validity The invariant holds only under the following conjunction, and any article or implementation that omits one of these is wrong: 1. **The envelope's `card_digest` MUST be computed over the canonicalized card bytes as fetched by the *caller* at signing time**, using a canonicalization (JCS / RFC 8785) that both parties agree on. If the callee canonicalizes differently — key ordering, Unicode normalization, number formatting — the digest mismatch is spurious and the check is useless. This is the most common source of false positives and the reason many implementations "log and proceed." 2. **The callee MUST resolve the card at verification time from the URL in the envelope, hash it, and compare to `card_digest`.** It MUST NOT compare the envelope's digest to a digest it stored at registration time, and it MUST NOT trust the envelope's digest as self-certifying. 3. **On mismatch, the callee MUST reject with a typed error and MUST NOT execute the task.** The correct behavior is to return a `Task` in state `rejected` with reason `card_digest_mismatch`, carrying the callee's *current* digest so the caller can re-resolve and re-sign. Proceeding on mismatch — even with a warning — is the failure. 4. **The caller MUST treat a `card_digest_mismatch` rejection as a signal to invalidate its cached card and re-resolve**, not as a transient error to retry against the same digest. Retrying against the same digest is a livelock. The condition fails when any of: canonicalization is unspecified, the callee self-certifies, mismatch is downgraded to a warning, or the caller retries without re-resolving. In the observed incident, conditions 2 and 3 both failed. ## Decision Boundary The boundary is not "is the signature valid" — that is necessary but not sufficient. The boundary is: **does the card resolved at verification time hash to the digest the caller signed?** These diverge exactly when the callee's card has been re-published between signing and verification, which is the normal case for any agent that redeploys, adds a skill, or changes its input modes. The decision table the callee must implement: | Signature | Resolved-card digest == `card_digest` | Action | |---|---|---| | valid | yes | execute against the resolved card's capability surface | | valid | no | **reject `card_digest_mismatch`**, return current digest | | invalid | — | reject `signature_invalid` | | valid | card URL unreachable | reject `card_unresolvable` (do not fall back to cached card) | The fourth row is the one most implementations get wrong: they fall back to a locally cached card to "keep the pipeline moving," which reintroduces the exact divergence the digest was meant to prevent. An unreachable card is a *verification failure*, not a *verification bypass*. There is a second, narrower boundary: **the callee must not execute against a capability surface broader than the one signed, even if the digest matches.** If the callee's runtime has been reconfigured (env vars, feature flags) to enable a capability the signed card did not advertise, the digest check passes but the authority assumption is still violated. The signed card is a *ceiling*, and the callee must enforce `effective_capabilities ⊆ signed_capabilities` at execution time. ## Operational Effect The practical consequence of getting this wrong is not a security breach in the classic sense — the payload is authenticated. It is **silent capability drift**: the caller's policy engine authorized a delegation under a capability assumption that the callee no longer honors, and the callee executed under a capability surface the caller never approved. Downstream, this manifests as malformed protocol frames, nondeterministic ordering, and doubled token spend from lenient re-queuing — all of which are expensive to trace back to a card re-publish three minutes before the batch was signed. The guardrail is a single line of discipline: **the card is verified by re-resolving and re-hashing at receipt, and a mismatch is a hard rejection carrying the new digest.** Cache the card for *routing* decisions at the caller; never cache it for *verification* at the callee. And when the callee re-publishes its card, it must invalidate in-flight envelopes signed against the old digest — which in practice means the caller must be prepared to re-sign, and the callee must never execute a batch it has not verified against its own current bytes. The asymmetry to internalize: the caller signs a *commitment*; the callee verifies a *claim*. A commitment to a digest is only meaningful if the callee checks that its current bytes still match that digest before acting. Otherwise the signature authenticates a card that no longer exists. ```python import hashlib import json class CardDigestMismatchError(RuntimeError): """Raised when the resolved Agent Card does not match the signed digest.""" class CardUnresolvableError(RuntimeError): """Raised when the Agent Card cannot be fetched at verification time.""" class CapabilityCeilingViolationError(RuntimeError): """Raised when effective runtime capabilities exceed the signed card's surface.""" def canonicalize(card: dict) -> bytes: # RFC 8785 JCS: sorted keys, no whitespace, UTF-8. return json.dumps(card, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode("utf-8") def digest(card: dict) -> str: return "sha256:" + hashlib.sha256(canonicalize(card)).hexdigest() def verify_envelope(envelope: dict, resolve_card, effective_capabilities: dict) -> dict: signed_digest = envelope["card_digest"] try: current_card = resolve_card(envelope["card_url"]) except Exception as exc: raise CardUnresolvableError( f"cannot resolve {envelope['card_url']} at verification time; " f"refusing to fall back to cached card" ) from exc current_digest = digest(current_card) if current_digest != signed_digest: raise CardDigestMismatchError( f"envelope signed for {signed_digest} but callee card is now {current_digest}; " f"rejecting task and returning current digest for re-signing" ) signed_caps = current_card.get("capabilities", {}) for name, enabled in effective_capabilities.items(): if enabled and not signed_caps.get(name, False): raise CapabilityCeilingViolationError( f"runtime capability {name!r} enabled but not advertised in signed card" ) return current_card def handle_task(envelope: dict, resolve_card, effective_capabilities: dict) -> dict: try: card = verify_envelope(envelope, resolve_card, effective_capabilities) except CardDigestMismatchError as exc: return {"state": "rejected", "reason": "card_digest_mismatch", "detail": str(exc)} except (CardUnresolvableError, CapabilityCeilingViolationError) as exc: return {"state": "rejected", "reason": "verification_failed", "detail": str(exc)} return {"state": "working", "card": card, "task": envelope["task_payload"]} ```