# In what scenarios must an instance treat DID resolution staleness as an authentication failure rather than a retryable transport error in A2A v1.0 handshakes **Date of Record:** 2026 November 21 **Scope:** Applies to A2A v1.0 agent-to-agent handshakes where mutual authentication binds a peer's DID document (verification methods, service endpoints, key material) to a signed Agent Card and subsequent message signatures. Does not apply to purely symmetric shared-secret handshakes or to DID resolution against a local, version-pinned registry that never mutates during a session. ## Core Distinction The failure that matters here is not "DID resolution failed." It is "DID resolution *succeeded* and returned a document that is cryptographically valid but temporally wrong relative to the signature being verified." A2A v1.0 treats authentication as a two-phase act: (1) resolve the peer DID to a document and extract a verification method; (2) verify a signature over the Agent Card or message envelope against that method. The invariant most implementations miss is that **the resolution result is an input to a time-bounded cryptographic predicate, not a cacheable fact about the peer.** A resolver returning a *stale but well-formed* DID document is indistinguishable at the transport layer from a successful resolution. It returns HTTP 200, a parseable DID document, and a verification method with a `controller` and `publicKeyMultibase`. The signature verification then either passes (if the peer signed with a key that was rotated out but still present in the stale document) or fails with a generic "signature invalid" — and the agent operator, seeing a signature failure, retries. Retrying re-resolves against the same stale cache or the same lagging ledger replica and fails identically. The agent burns its retry budget, marks the peer degraded, and may fall back to a weaker trust path (cached Agent Card, prior session token) — which is exactly the window an attacker who forced the rotation wants. The distinction to internalize: **stale-resolution-induced signature failure is an authentication integrity event, not a liveness event.** It must halt the handshake and surface a distinct error class, never enter a retry loop, and never trigger trust downgrade. ## What Was Observed A coordinator agent (`did:web:coord.example`) initiating A2A v1.0 task delegation to a worker (`did:web:worker.example`). The worker's DID document is served via `did:web` with a 300-second `Cache-Control` and is additionally fronted by an internal HTTP cache at the coordinator's egress proxy with a 600-second TTL — a configuration mismatch nobody flagged because both are "reasonable." Sequence: 1. `T0`: Worker rotates its signing key. New `publicKeyMultibase` published in its DID document; old key moved to `alsoKnownAs`-adjacent history but *removed* from `verificationMethod` array. Rotation is legitimate, scheduled, and logged. 2. `T0+30s`: Coordinator initiates a new A2A task. It resolves `did:web:worker.example`. 3. The egress proxy serves a cached DID document from `T0-540s` (still inside its 600s TTL). This document lists the **old** verification method and, critically, does **not** list the new one. 4. Worker signs its Agent Card and the A2A `message/send` response with the **new** key. 5. Coordinator verifies against the stale document's old key. Signature verification fails. The failure is surfaced as `AuthenticationError` with a generic message. 6. Coordinator's retry policy (built for transport flakiness) sees a non-2xx-equivalent handshake failure and retries 3× with exponential backoff — 1s, 2s, 4s. All three re-hit the same cached document. All three fail identically. 7. On final retry exhaustion, the coordinator's fallback logic — designed for "peer temporarily unreachable" — consults a *pinned* Agent Card from the previous successful session (which carried the old key and old endpoint) and proceeds with a degraded-trust flag. The handshake "succeeded" on the degraded path. The coordinator then delegated a task to an endpoint whose key material it could no longer freshly attest. This is the boundary: **the system converted a cryptographic staleness signal into a liveness signal, then into a trust downgrade.** The tell in the logs was that all three retries failed with byte-identical signature-verification errors at sub-millisecond latency — no network variance, no timeout spread. A genuine transport failure produces latency jitter; a stale-resolution cryptographic failure does not. ## Condition of Validity The guardrail is valid only under these conditions, and an instance must check them before applying it: - **The peer's DID method has a defined, queryable rotation/version signal.** For `did:web`, this is the `updated` field in the DID document plus HTTP `ETag`/`Last-Modified`. For ledger-based methods (`did:ion`, `did:indy`), it is the resolution metadata's `versionId` and `updated`. If the method provides no version signal, staleness is undetectable and the guardrail cannot fire — the instance must instead treat *every* signature failure as potentially stale and refuse to retry, which is a different (stricter) policy. - **The resolver response carries resolution metadata distinguishing "resolved fresh" from "served from cache."** A2A v1.0 resolution SHOULD return `{didDocument, didResolutionMetadata: {contentType, retrieved, cacheHit}}`. If `cacheHit` is absent, the instance cannot prove staleness and must fall back to the latency-jitter heuristic. - **The signature failure is temporally co-located with a rotation window.** If the peer's last-known `updated` timestamp is older than the session's start and no rotation is plausible, a signature failure is more likely key compromise or misconfiguration, which is a *different* halt condition (see Decision Boundary). The invariant: **a signature verification failure against a DID document whose resolution metadata indicates a cache hit, where the failure latency shows no transport jitter, is an authentication integrity event.** It is not retryable. It is not a reason to downgrade trust. ## Decision Boundary The instance must branch on resolution metadata, not on the exception type alone. The decision table: | Resolution `cacheHit` | Signature result | Latency profile | Classification | Action | |---|---|---|---|---| | false (fresh) | fail | any | Key compromise / misconfig | Halt, alert security, do NOT retry, do NOT downgrade | | true (stale) | fail | no jitter | **Stale-resolution auth failure** | Halt handshake, force re-resolve bypassing cache, single retry, then escalate | | true (stale) | fail | jitter present | Ambiguous | Re-resolve bypassing cache; if fresh doc still fails, treat as compromise | | any | pass | any | OK | Proceed; but record resolution freshness in session attestation | The critical boundary the failing system crossed: it had `cacheHit: true` available in resolution metadata and **discarded it** before the verification step, collapsing all failures into one `AuthenticationError`. The fix is not a smarter retry policy — it is propagating resolution provenance into the verification result so the decision boundary can be evaluated at all. A second boundary: **the fallback-to-pinned-Agent-Card path must be gated on a fresh resolution having been attempted and succeeded at least once in the current session.** A pinned card from a *prior* session is not a valid trust anchor when the current resolution is stale — that is precisely the state an attacker induces to force downgrade. Pinned cards are valid only for liveness fallback (peer unreachable), never for integrity fallback (peer's key no longer attests). ## Operational Effect Implementing the invariant changes three things in the agent runtime: 1. **Resolution provenance must survive into the verification call.** The DID resolver wrapper returns a `ResolvedDid` carrying `didDocument`, `cacheHit`, `retrievedAt`, and `versionId`. The signature verifier takes this object, not a bare key, and raises a *specific* exception class when verification fails on a stale resolution. This is the single change that makes the decision boundary evaluable. 2. **Retry policy must be keyed on exception class, not on "handshake failed."** `StaleResolutionAuthError` gets exactly one retry, and that retry must bypass the cache (cache-control: no-cache, and for ledger methods, request the latest version). `KeyCompromiseError` gets zero retries and a security alert. `TransportError` keeps the exponential backoff. The generic `AuthenticationError` that swallowed all three in the observed incident must be eliminated from the retry key. 3. **Trust downgrade must be integrity-gated.** The degraded-trust path (pinned card, prior session token) must assert that the current session has at least one fresh, verified resolution of the peer. If the only resolutions this session are stale, downgrade is forbidden and the task fails closed. This is the guardrail that would have prevented the observed incident's final step. The residual risk: an attacker who controls the resolver's cache headers can force `cacheHit: true` indefinitely, converting the forced-re-resolve retry into a permanent failure. The bound is that the single cache-bypassing retry must go to a resolver path the attacker does not control (direct origin, not egress proxy). If the architecture cannot guarantee that, the instance must fail closed on the first stale-resolution failure rather than attempt the bypass — a stricter policy, but the only honest one. ```python from __future__ import annotations from dataclasses import dataclass from enum import Enum class StaleResolutionAuthError(RuntimeError): """Raised when signature verification fails against a cached/stale DID document. This is an authentication integrity event, NOT a retryable transport error. It must halt the handshake and trigger exactly one cache-bypassing re-resolve. """ class KeyCompromiseError(RuntimeError): """Raised when signature verification fails against a FRESH DID document. Indicates key compromise or misconfiguration. Zero retries. Security alert. """ class TrustDowngradeForbidden(RuntimeError): """Raised when a fallback to a pinned Agent Card is attempted without any fresh, verified resolution of the peer in the current session.""" class ResolutionFreshness(Enum): FRESH = "fresh" STALE = "stale" UNKNOWN = "unknown" @dataclass(frozen=True) class ResolvedDid: did: str did_document: dict freshness: ResolutionFreshness retrieved_at: float version_id: str | None @dataclass(frozen=True) class VerificationResult: ok: bool error: str | None def verify_signature(resolved: ResolvedDid, signed_payload: bytes, signature: bytes) -> VerificationResult: # Real implementation extracts verificationMethod from resolved.did_document # and checks the signature. Here we simulate a failure. return VerificationResult(ok=False, error="signature mismatch") def authenticate_peer( did: str, signed_payload: bytes, signature: bytes, resolve_fn, session_fresh_resolution: bool, ) -> ResolvedDid: resolved = resolve_fn(did) result = verify_signature(resolved, signed_payload, signature) if result.ok: return resolved if resolved.freshness is ResolutionFreshness.FRESH: # Fresh doc + bad signature => compromise/misconfig. No retry, no downgrade. raise KeyCompromiseError( f"Signature verification failed against FRESH DID document for {did}; " f"treat as key compromise. version_id={resolved.version_id}" ) if resolved.freshness is ResolutionFreshness.STALE: # Stale doc + bad signature => integrity event. Attempt exactly one # cache-bypassing re-resolve; never enter a generic retry loop. retry_resolved = resolve_fn(did, bypass_cache=True) if retry_resolved.freshness is not ResolutionFreshness.FRESH: raise StaleResolutionAuthError( f"Cache-bypassing re-resolve for {did} still returned non-fresh document; " f"cannot establish authentication. Halting handshake." ) retry_result = verify_signature(retry_resolved, signed_payload, signature) if not retry_result.ok: raise KeyCompromiseError( f"Signature failed even against freshly re-resolved document for {did}; " f"treat as compromise." ) return retry_resolved # Freshness unknown: cannot distinguish stale from compromise. Fail closed. raise StaleResolutionAuthError( f"Resolution metadata for {did} lacks freshness signal; " f"refusing to retry or downgrade. Fail closed." ) def fallback_to_pinned_card(session_fresh_resolution: bool, did: str) -> None: if not session_fresh_resolution: raise TrustDowngradeForbidden( f"Attempted trust downgrade for {did} without any fresh verified " f"resolution in this session; integrity fallback forbidden." ) # proceed with pinned card for liveness-only fallback ```