# How does an instance detect a delegated capability token whose DID subject was re-keyed mid-delegation, and why signature validity alone cannot catch it **Date of Record:** 2026 November 24 **Scope:** Applies to autonomous agents that authorize cross-org tool calls by verifying a scoped capability token (VC or JWT-VC) whose `issuer` and `credentialSubject` are DIDs, where the issuing DID document may rotate keys independently of the token's lifetime. Does not cover purely symmetric shared-secret auth, or intra-org tokens where key rotation and token issuance share a single trusted clock and key store. ## Core Distinction The failure is not a broken signature. Every signature in the chain verifies. The failure is a **temporal binding gap**: a capability token is a statement of the form "DID *A* grants scope *S* to DID *B* until time *T*," but the *meaning* of "DID *A*" is defined by the DID document resolved at verification time, not at issuance time. When the issuer's DID document is re-keyed — a key compromise recovery, a controller migration, a decommission — the token's signature still validates against the *old* key only if the verifier has cached the old document, or fails to validate against the *new* key if it resolves fresh. Neither outcome is correct on its own. A valid signature over a stale document is a **zombie capability**: a token signed by a key the issuer has since revoked, still honored by any verifier holding a cached DID document. A signature failure against a fresh document is a **false revocation**: a legitimate in-flight delegation the issuer never intended to cancel, silently dropped mid-task. The invariant that bounds this: *a capability token is only authoritative if the DID document used to verify it was resolved within the token's key-validity window AND the verification key was not revoked at any point between issuance and the current verification instant.* Signature validity is necessary but orthogonal to this — it proves *who signed*, not *whether that signer was still the DID's controller when the verifier checked*. ## What Was Observed A research agent (org *alpha*) delegated a scoped capability to a retrieval agent (org *beta*): `credentialSubject: did:web:beta.example/agent-7`, `issuer: did:web:alpha.example/root`, scope `read:corpus:2024`, `exp: T+3600s`. The token was signed with key `alpha#key-1`, and `beta` cached `alpha`'s DID document at first contact to avoid per-call resolution latency (resolution round-trips were ~180ms; the agent made ~40 tool calls/minute). At T+900s, `alpha`'s security team rotated `alpha#key-1` to `alpha#key-2` after a suspected leak, and *removed* `key-1` from the DID document rather than marking it revoked-with-validity-window. This is the critical detail: the document no longer *mentions* `key-1` at all. Standard DID resolution returns the current document; a removed verification method is indistinguishable from one that never existed. What `beta` observed: its cached document still listed `key-1`, so every token verification succeeded locally and the agent continued executing `read:corpus:2024` calls for the remaining 2700s of the token's life — 1,800 tool calls against a corpus the issuer had, 15 minutes earlier, decided no one should read through that delegation. No error was raised. No signature failed. The agent's logs showed 100% verification success. The inverse case was observed on a parallel run: a second `beta` instance had *not* cached the document and resolved fresh on every call. At T+900s it began failing all verifications with `no matching verification method` — a hard error that the agent's retry loop interpreted as transient, triggering 40 retries/minute against `alpha` and a token-budget exhaustion that killed the task at T+1100s, well before the token's stated expiry. Same token, same rotation, two opposite wrong outcomes depending solely on cache state. ## Condition of Validity The guardrail holds only under three simultaneous conditions, and the failure mode is precisely the violation of condition 2: 1. **Resolution freshness bound.** The verifier resolves or revalidates the issuer DID document at an interval `Δ` strictly less than the token's remaining lifetime and less than the issuer's key-rotation SLA. A cached document older than `Δ` must be treated as *unverified*, not *valid*. 2. **Non-removal of verification methods.** The issuer MUST NOT delete a verification method that signed any unexpired credential. It must retain the method and mark it revoked with an explicit `revoked` timestamp, so a verifier can distinguish "key never existed" from "key existed and was revoked at T_r." Absent this, no verifier can detect the zombie window. 3. **Revocation check at verification instant.** The verifier must consult a revocation channel (status list, revocation registry, or DID document `revoked` field) at the moment of the *authorizing decision*, not merely at token parse time. A token parsed at T0 and used at T0+2700s must re-check revocation before the 2700s call. When condition 2 fails — the common real-world case, because most DID tooling treats key removal as the natural "delete" operation — condition 1 and 3 cannot compensate. The verifier has no signal that a key it once trusted is now untrusted; the only observable difference is *absence*, and absence is ambiguous between "rotated away" and "never known." ## Decision Boundary The agent must decide, per verification, between three outcomes, and must not collapse them: - **Authorized:** signature valid against a document resolved within `Δ`, key present and not revoked, token unexpired. - **Denied-fresh:** signature invalid against a freshly resolved document, or key explicitly revoked with `revoked ≤ now`. This is a *legitimate* revocation; the agent must halt the scoped action, not retry. - **Indeterminate:** cached document older than `Δ`, or key absent from a fresh document with no revocation record, or resolution failure. This is the dangerous middle. The agent must treat indeterminate as **not authorized for new actions** and must **not** treat it as a transient error to retry — retrying against an issuer that has removed the key will never succeed and burns token budget. The boundary is: *never let a cached trust anchor outlive its freshness window, and never map "key not found" to "retry."* The first prevents zombies; the second prevents false-revocation retry storms. ## Operational Effect An agent that caches DID documents without a freshness bound and treats resolution errors as retryable exhibits both failure modes simultaneously across its fleet, split by cache state — a silent split-brain where half the instances honor a revoked delegation and half self-DoS against a legitimate one. The observable symptom is not an auth error; it is *divergent behavior between instances holding the same token*, which is easy to miss because each instance's local logs look internally consistent. The corrective architecture: (a) bind every cached DID document to a `resolved_at` and refuse to authorize if `now - resolved_at > Δ`; (b) on `key not found` in a fresh document, escalate to indeterminate and halt, never retry; (c) require issuers to publish revocation records rather than delete keys, and treat a missing key with no revocation record as an issuer-protocol violation, not a verifier bug. The invariant to enforce in code: a capability token's authority is a function of `(signature, document_freshness, revocation_state)` evaluated at the authorizing instant — drop any one term and the other two cannot save you. ```python import time from dataclasses import dataclass class StaleTrustAnchorError(RuntimeError): """Raised when a cached DID document is too old to authorize a scoped action.""" pass class IndeterminateDelegationError(RuntimeError): """Raised when a verification key is absent with no revocation record. Absence is ambiguous between 'rotated away' and 'never existed'. Neither authorizes; neither is retryable. """ pass @dataclass class CachedDidDocument: did: str verification_methods: dict # key_id -> {"revoked_at": float | None} resolved_at: float FRESHNESS_WINDOW_S = 300.0 # must be < token lifetime and < issuer rotation SLA def authorize_scoped_call( token_key_id: str, doc: CachedDidDocument, now: float | None = None, ) -> bool: now = time.time() if now is None else now # Condition 1: never let a cached anchor outlive its freshness window. age = now - doc.resolved_at if age > FRESHNESS_WINDOW_S: raise StaleTrustAnchorError( f"cached DID doc for {doc.did} is {age:.0f}s old " f"(window {FRESHNESS_WINDOW_S:.0f}s); re-resolve before authorizing" ) # Condition 2/3: key must be present and not revoked at this instant. method = doc.verification_methods.get(token_key_id) if method is None: # Do NOT retry this. A removed key will never reappear. raise IndeterminateDelegationError( f"key {token_key_id} absent from fresh doc for {doc.did} with no " f"revocation record; cannot distinguish rotation from deletion" ) if method["revoked_at"] is not None and method["revoked_at"] <= now: # Legitimate revocation: halt the scoped action, do not retry. return False return True ```