# How does an instance detect a DID-to-Capability-Token binding drift across a multi-hop agent call chain? **Date of Record:** 2026 November 24 **Scope:** Applies to agent-to-agent (A2A) and MCP-mediated call chains where each hop presents a W3C DID plus a short-lived, attenuating capability token (e.g., a macaroon or Biscuit) whose caveats bind the token to the presenter's DID and to the requesting principal. Does not apply to single-hop calls where the verifier directly observes the original issuer, nor to long-lived OAuth bearer tokens without per-hop attenuation. ## Core Distinction The failure is not "the token expired" and not "the signature is invalid." Both of those are loudly detectable. The failure is that a *valid, unexpired, correctly signed* token arrives at a verifier whose `aud`/`iss`/subject-binding caveats are structurally satisfied, yet the DID actually controlling the signing key at the current hop is **not the DID the token was minted to authorize**. This happens because capability tokens and DIDs are verified on two separate trust paths that are reconciled only by a string comparison of `did:...` identifiers — and DID documents are *mutable* and *resolvable at different times* from the token's issuance. Concretely: Hop A mints a token with caveat `presenter_did = did:web:agent-a`. Hop A delegates to Hop B, appending `delegate_to = did:web:agent-b`. Hop B presents to Hop C. Hop C resolves `did:web:agent-b`, checks the signature against the resolved key, checks the caveat chain — all pass. But if `did:web:agent-b`'s document was **rotated** (key replaced, or the DID's `alsoKnownAs`/service endpoint repointed) between token mint and token verification, the *identity that the token was bound to* and the *identity now presenting it* are the same DID string but a different cryptographic actor. The binding invariant — "the DID string in the token caveat names the key that signs this hop" — is silently violated. ## What Was Observed A three-hop research pipeline: orchestrator (Hop A, `did:web:orch.example`), retrieval sub-agent (Hop B, `did:web:retriever.example`), and a synthesis/auditor agent (Hop C, `did:web:auditor.example`). Tokens are Biscuit-style, TTL 90s, attenuated per hop. Trace of the failing call: 1. Hop A mints token `T0` with caveats `[iss=orch, presenter=did:web:retriever.example, exp=T+90s, aud=auditor.example]`, signs with `orch#key-1`. 2. Hop A resolves `did:web:retriever.example` and obtains `key-2024a`. It embeds `delegate_key_thumbprint=key-2024a` in the attenuation block. 3. Hop B receives `T0`, appends caveat `delegate_to=did:web:auditor.example`, re-signs with its **currently active** key `key-2024b`. 4. Between step 2 and step 3, `did:web:retriever.example`'s document was rotated: `key-2024a` was deactivated and `key-2024b` promoted. The rotation is legitimate and propagated to the resolver. 5. Hop C resolves `did:web:auditor.example`, verifies Hop B's signature against `did:web:retriever.example`'s *current* document → finds `key-2024b` → **signature verifies**. It checks the caveat `delegate_key_thumbprint=key-2024a` — this is a *string* in the token, and the verifier's naive check compares it against the signing key's thumbprint. `key-2024b ≠ key-2024a` → this check *should* fail, but only if the verifier actually performs it. 6. In the observed implementation, the verifier validated the token signature and the caveat *presence*, but treated `delegate_key_thumbprint` as advisory metadata (a "hint") rather than a mandatory binding predicate. It passed the call. The auditor accepted a synthesis request from an actor whose key was rotated *after* the delegation was authorized, and — critically — the token's `presenter` caveat still read `did:web:retriever.example`, which the verifier read as "the retriever is authorized," when the *specific key* authorized was no longer the one presenting. The observable symptom was not a hard error. It was a **silent acceptance followed by a downstream anomaly**: the auditor's replay log recorded the request under `did:web:retriever.example@key-2024b`, but the orchestrator's audit trail recorded the delegation under `did:web:retriever.example@key-2024a`. Reconciliation at end-of-run flagged a *verification replay discrepancy* — same DID, two key thumbprints, no rotation event linking them in the token chain. The chain had a "key gap." A second, subtler variant: `did:web` documents are fetched over HTTPS with caching. If Hop C's resolver cache held a pre-rotation document (TTL 300s) while Hop B signed with the post-rotation key, verification *failed loudly* — the opposite error. So the same drift produces either a false accept (cache fresh, token stale) or a false reject (cache stale, token fresh) depending on cache phase. The false accept is the dangerous one. ## Condition of Validity The binding invariant that must hold for the chain to be sound: > For every hop *h* in the call chain, the key that signs the token presented at *h* must be a key that was (a) listed in the DID document resolved at the time the *delegation to h* was authorized, and (b) not deactivated at the time of presentation. The token must carry a *cryptographic commitment* to that specific key, not merely to the DID string. This invariant holds only when three conditions are simultaneously satisfied: 1. **Key-level binding, not DID-level binding.** The token caveat must commit to a key thumbprint (RFC 7638 JWK thumbprint or multibase key ID), and the verifier must treat that thumbprint as a *mandatory* predicate, failing closed on mismatch. 2. **Resolution-time anchoring.** The verifier must either (i) resolve the DID document at the same logical time the delegation was authorized and carry that resolution's version/digest in the token, or (ii) require the token to include a proof that the signing key was valid at mint time (e.g., a `key_assertion` signed by the DID's controller, or a transparency-log inclusion proof). 3. **Rotation transparency.** DID document rotations must be observable to verifiers — either via a monotonic `versionId` in the document that the token commits to, or via a transparency log whose inclusion proof the presenter supplies. Without this, a rotation is indistinguishable from a key substitution attack. If any of these is absent, the chain is *structurally* valid but *semantically* unsound: it authorizes a DID, not an actor. ## Decision Boundary The operational question for an instance at the verifier role is: **when the signing key's thumbprint differs from the token's committed thumbprint, do I fail closed, or do I accept on the theory that "the DID is still the same"?** The boundary is crossed as follows: - **Accept** only if the token carries a rotation proof: a signed statement from the DID controller (or a transparency-log entry) asserting `key-2024a → key-2024b` with a timestamp *before* the token's mint time and *after* the delegation authorization. In that case the binding is preserved across the rotation and the call is legitimate. - **Reject** (fail closed) if the thumbprint mismatch is unexplained, if the rotation proof is absent, or if the rotation timestamp is *after* the token's `exp` (meaning the rotation happened after the authorization window closed — the presenter is using a key that did not exist when it was authorized). - **Escalate** to the auditor/orchestrator (out-of-band, not via the same token chain) if the mismatch is accompanied by a valid-but-late rotation proof, since this indicates a race between rotation and delegation that the orchestrator must reconcile in its own audit trail. The boundary is *not* "did the signature verify." A signature can verify against a rotated key while the binding is broken. The boundary is "does the token's key commitment match the presenting key, and if not, is there a chain-of-custody proof that the mismatch is a legitimate rotation rather than a substitution?" ## Operational Effect When the boundary is enforced (fail closed on unexplained thumbprint mismatch), the effect is a small increase in false rejects during legitimate rotation windows — bounded by the resolver cache TTL and the rotation propagation delay. This is the correct trade: a false reject is a retryable liveness cost; a false accept is a silent integrity violation that corrupts the audit trail and can propagate poisoned state into downstream agents (the auditor in the trace above ingested a synthesis request whose provenance it could not later reconcile). When the boundary is *not* enforced (the observed failure), the effect is a **key gap**: a DID string that appears consistent across the chain but resolves to two different keys at two different hops, with no token-level record linking them. Downstream verification replay cannot reconstruct which actor authorized which action. In multi-agent swarms this manifests as *conflicting auditor consensus* — two auditors replaying the same chain reach different verdicts because they resolved the DID at different times and cached different documents. The disagreement is not a bug in either auditor; it is a genuine ambiguity in the chain, and it is unresolvable after the fact because the rotation event was never committed to the token. The architectural guardrail: **tokens must commit to keys, not DIDs, and verifiers must treat key-thumbprint caveats as mandatory binding predicates with a fail-closed default.** Rotation must be proven, not assumed. A DID that resolves to a new key is a *new actor* until a rotation proof says otherwise. ```python import hashlib import time from dataclasses import dataclass, field from typing import Optional class BindingDriftError(RuntimeError): """Raised when a capability token's committed key thumbprint does not match the key actually presenting at the current hop, and no valid rotation proof bridges the gap.""" pass @dataclass class DidDocument: did: str active_key_thumbprint: str version_id: int resolved_at: float rotations: dict = field(default_factory=dict) # old_thumb -> (new_thumb, timestamp) @dataclass class CapabilityToken: issuer_did: str presenter_did: str committed_key_thumbprint: str # RFC 7638 thumbprint of the key authorized at mint signing_key_thumbprint: str # thumbprint of the key that actually signed this hop minted_at: float expires_at: float rotation_proof: Optional[dict] = None # {"from": thumb, "to": thumb, "signed_at": ts} def jwk_thumbprint(public_key_material: str) -> str: return hashlib.sha256(public_key_material.encode()).hexdigest()[:16] def verify_hop( token: CapabilityToken, resolved_doc: DidDocument, now: Optional[float] = None, ) -> bool: now = now if now is not None else time.time() # 1. Temporal validity — loud, cheap. if now > token.expires_at: raise BindingDriftError(f"token expired at {token.expires_at}, now={now}") # 2. Signature must verify against the *currently resolved* key. if token.signing_key_thumbprint != resolved_doc.active_key_thumbprint: raise BindingDriftError( f"signing key {token.signing_key_thumbprint} is not the active key " f"{resolved_doc.active_key_thumbprint} for {resolved_doc.did}" ) # 3. THE BINDING INVARIANT: committed key must equal presenting key, # OR a rotation proof must bridge them within the authorization window. if token.committed_key_thumbprint != token.signing_key_thumbprint: proof = token.rotation_proof if proof is None: # Silent-accept failure mode: naive verifiers stop here and pass. raise BindingDriftError( f"key gap: token committed to {token.committed_key_thumbprint} " f"but hop presents {token.signing_key_thumbprint} with no rotation proof" ) # Rotation proof must (a) match the committed key, (b) match the presenter, # (c) have been signed *during* the token's authorization window. if proof.get("from") != token.committed_key_thumbprint: raise BindingDriftError("rotation proof 'from' does not match committed key") if proof.get("to") != token.signing_key_thumbprint: raise BindingDriftError("rotation proof 'to' does not match presenting key") signed_at = proof.get("signed_at", float("inf")) if not (token.minted_at <= signed_at <= token.expires_at): raise BindingDriftError( f"rotation proof signed_at={signed_at} outside authorization window " f"[{token.minted_at}, {token.expires_at}]" ) # Cross-check against the DID document's own rotation record. recorded = resolved_doc.rotations.get(token.committed_key_thumbprint) if recorded is None or recorded[0] != token.signing_key_thumbprint: raise BindingDriftError( "rotation proof not corroborated by DID document rotation record" ) return True def verify_chain(tokens: list[CapabilityToken], docs: dict[str, DidDocument]) -> None: for i, tok in enumerate(tokens): doc = docs.get(tok.presenter_did) if doc is None: raise BindingDriftError(f"hop {i}: no DID document for {tok.presenter_did}") verify_hop(tok, doc) ```