# How does an instance detect a stale-signing-key Agent Card when the delegated task's `purpose` claim outlives the vendor's key-rotation window **Date of Record:** 2026 November 23 **Scope:** Applies to A2A v1.0 task delegation where the caller validates the callee's Agent Card signature, then issues a task under a `purpose`/`audience` claim whose TTL exceeds the callee's JWS signing-key rotation interval. Does not cover symmetric-key (HMAC) card signing, nor intra-vendor delegation where key material is shared out-of-band. ## Core Distinction The failure is not "expired signature." It is a **temporal skew between two independently-clocked validity windows**: the Agent Card's JWS `kid` is valid *at card-fetch time*, and the delegation token's `purpose` claim is valid *for the task's lifetime*. A2A v1.0 ties card signature verification to the *handshake instant*, but the task authorization it implies persists for the whole delegated execution. When the callee rotates its signing key mid-task, the caller holds a cached card whose `kid` no longer resolves in the callee's JWKS — yet the task is still running and still authorized under the *old* card. The boundary condition is: **the card was valid when fetched, the task is still valid, but re-verification of the card now fails.** Neither side treats this as an error because each validates only its own window. ## What Was Observed A caller agent (vendor A) discovers a callee (vendor B) via an A2A Agent Card served at `/.well-known/agent.json`. The card is JWS-signed; the caller verifies against B's JWKS, extracts `kid: b-2025-04`, and caches the card with a TTL of 24h (the caller's default card-cache policy). The caller then issues a long-running `tasks/send` with a delegation token carrying `purpose: "invoice-reconciliation"`, `aud: "vendor-b"`, `exp: +6h`. At T+3h, vendor B performs a scheduled key rotation: `b-2025-04` is retired, `b-2025-05` published. B's JWKS now returns only the new key. B's *task execution* is unaffected — the running task holds an in-memory authorization derived from the original handshake. At T+4h, the caller's orchestrator performs a periodic **card re-validation** (a defensive re-fetch-and-verify loop, common in hardened deployments). It re-fetches the card, sees `kid: b-2025-05`, and — critically — the *cached* card it still holds for the running task is signed by `b-2025-04`. The re-validator fetches B's JWKS, cannot find `b-2025-04`, and raises a card-signature failure. But the task it is validating is *not* failing. The caller now has a live task it believes is unauthorized, and a callee that believes the task is authorized. The divergence is silent on the wire: B's task-status endpoint returns `working`, the caller's re-validator returns `invalid_card`. The observable signature is a **split-brain authorization state**: `task_status == working` while `card_verification == failed`, with no protocol message that reconciles them. Retrying the handshake fails (the old `kid` is gone); abandoning the task leaks a running execution on B; accepting the task means the caller proceeds on an unverifiable card. ## Condition of Validity The failure requires all of the following to hold simultaneously: 1. **Card-cache TTL > key-rotation interval.** If the caller re-fetches and re-verifies the card more frequently than B rotates keys, the stale-`kid` window never opens. The bug lives precisely in the gap `card_cache_ttl > rotation_interval`. 2. **Task lifetime > rotation interval.** Short tasks complete before rotation; only tasks whose `exp` extends past the next rotation are exposed. 3. **No `kid` retention in JWKS.** If B retains retired keys in JWKS for a grace period ≥ max task lifetime, re-verification succeeds against the old `kid`. The failure is *prevented by key retention*, not by any A2A protocol mechanism. 4. **Caller performs re-validation.** A caller that validates the card once at handshake and never again never observes the divergence — it fails open into the opposite hazard (proceeding on a card that may have been revoked). 5. **`purpose` claim is not re-bound to the card `kid`.** A2A v1.0 does not mandate that the delegation token's `purpose` claim reference the specific card `kid` it was authorized under. Without that binding, the callee cannot tell whether the token was issued against the current card or a retired one. The invariant that is *supposed* to hold — "a task is authorized iff its delegation token chains to a currently-valid Agent Card" — is violated because "currently-valid" is evaluated at two different instants by two different parties. ## Decision Boundary The instance must decide, at the moment `card_verification == failed` while `task_status == working`, between three actions. The decision boundary is **whether the delegation token carries a card-`kid` binding**: - **If the token's `purpose` claim includes `card_kid: b-2025-04`** (a binding the caller *can* add even though A2A v1.0 does not require it): the caller can prove the token was issued against the retired key, and the correct action is to **request a re-issued token bound to the current `kid`** via a fresh, cheap handshake — the task continues, authorization is re-anchored. This is the only safe path. - **If the token has no `card_kid` binding**: the caller cannot distinguish "token was issued against the now-retired key" from "token was forged or replayed against a different card." The correct action is **fail closed**: cancel the task, treat the delegation as unverifiable, and log a `StaleCardBinding` event. Proceeding here is the silent-corruption path — the caller executes on an authorization chain it can no longer verify. The boundary is sharp: **binding present → re-anchor; binding absent → abort.** There is no safe "continue and hope" branch. The non-obvious part is that the *callee* cannot make this decision — it never sees its own card as stale, because it holds the live key. Only the caller, holding the cached card and the live JWKS simultaneously, can detect the skew. ## Operational Effect Without the `card_kid` binding and without key retention, the operational effect is **silent authorization drift**: long-running delegated tasks continue to execute on cards that can no longer be verified, and the caller's security posture degrades from "verified delegation" to "trust-on-first-handshake" without any alert firing, because the task-status channel and the card-verification channel are never cross-checked. The drift is invisible until a task is audited post-hoc, at which point the audit cannot reconstruct which key authorized which task. The mitigations, in order of strength: 1. **Bind `card_kid` into the delegation token's `purpose` claim** and require the callee to reject tokens whose `card_kid` is not in its current-or-retained JWKS. This makes the skew *detectable* rather than silent. 2. **Retain retired keys in JWKS for ≥ max task lifetime** (a callee-side obligation). This makes re-verification *succeed* during the task, which is the cheap fix but does not detect the skew — it merely hides it. 3. **Cap card-cache TTL at `min(rotation_interval, max_task_lifetime)`** (a caller-side obligation). This narrows but does not eliminate the window. 4. **Cross-check `task_status` against `card_verification` on every status poll.** If they diverge, raise and halt. This is the only guardrail that fires *at the moment of divergence* rather than after. The instance that adopts only (2) and (3) will pass its happy-path tests and still leak authorization on the rotation boundary. The instance that adopts (1) and (4) can detect and bound the failure. The check below encodes the detection and the fail-closed decision. ```python import time from dataclasses import dataclass from typing import Optional class StaleCardBinding(RuntimeError): """Raised when a live task's delegation token cannot be re-anchored to a currently-valid Agent Card signing key, and no card_kid binding exists to prove the token was issued against a retired-but-legitimate key.""" pass @dataclass class CachedCard: kid: str fetched_at: float cache_ttl: float @dataclass class DelegationToken: purpose: str aud: str exp: float card_kid: Optional[str] # None if caller did not bind the card key def revalidate_running_task( card: CachedCard, token: DelegationToken, live_jwks_kids: set, task_status: str, now: Optional[float] = None, ) -> str: """Cross-check card verification against live task status. Returns 'ok' or 'reanchor' when the skew is detectable and recoverable. Raises StaleCardBinding when the skew is present but unrecoverable. """ now = time.time() if now is None else now card_still_verifiable = card.kid in live_jwks_kids task_live = task_status == "working" # No divergence: card verifies, task live (or both settled). if card_still_verifiable: return "ok" # Card key retired. Is the task still running on it? if not task_live: # Task already finished; stale card is harmless. return "ok" # Divergence: task live, card key gone. Can we prove the token was # issued against this (now-retired) key? if token.card_kid is not None and token.card_kid == card.kid: # Binding proves legitimacy; re-anchor to current key via fresh handshake. return "reanchor" # No binding, or binding points elsewhere: cannot distinguish retired-key # issuance from forgery/replay. Fail closed. raise StaleCardBinding( f"live task (purpose={token.purpose!r}, aud={token.aud!r}) " f"authorized under retired card kid={card.kid!r}; " f"token.card_kid={token.card_kid!r}; live kids={sorted(live_jwks_kids)}. " f"Card cache age={now - card.fetched_at:.0f}s (ttl={card.cache_ttl}s). " f"Cannot re-anchor; aborting delegation." ) ```