# Which invariants prevent delegated-agent credential chains from silently re-rooting during DID resolution failover **Date of Record:** 2026 November 30 **Scope:** Applies to federated agent deployments where an agent's authority is carried as a chain of verifiable credentials (VCs) anchored to a decentralized identifier (DID), and DID resolution is served by a resolver set with failover. Does not apply to single-resolver, single-issuer setups or to bearer-token delegation schemes with no cryptographic chain. ## Core Distinction The failure mode is not "the credential failed to verify." It is that the credential verified *correctly* against a *different root than the one the delegating agent intended*. A verifiable credential chain is only as trustworthy as the binding between the `issuer` field, the DID document that resolved it, and the key material that signed the proof. When resolution fails over to a secondary resolver, that binding can be preserved, or it can be silently re-pointed while every signature check still returns `true`. The distinction that matters operationally: **signature validity is a local property of a single link; chain authority is a global property of the root.** Failover logic that treats "resolution succeeded" as the success condition is checking the local property and inferring the global one. Those are not the same predicate, and the gap between them is where delegated agent authority gets laundered. ## What Was Observed A three-tier delegation was in place: orchestrator agent `A` (root DID `did:web:ops.example`) delegated scoped tool-invocation rights to worker `B`, which sub-delegated a narrowed subset to sandboxed executor `C`. Each hop carried a VC whose `credentialSubject.id` was the next agent's DID and whose proof was signed by the previous hop's verification method. The primary resolver for `did:web` returned `503` for roughly 40 seconds during a rolling deploy. The agent runtime's resolver client had a configured fallback to a secondary resolver operated by a different federation member. The fallback resolved `did:web:ops.example` to a DID document that was *valid* — correct syntax, valid proof over the document, unexpired — but whose `verificationMethod` set was keyed to a different controller. This is the expected behavior of `did:web` under a host compromise or a stale mirror: the document is served by whoever controls the HTTPS endpoint, and the resolver faithfully returns it. The chain verifier checked each link in order: `C`'s credential verified against `B`'s key, `B`'s against `A`'s key, `A`'s self-issued root verified against the resolved `did:web:ops.example` document. Every link passed. The executor `C` proceeded to invoke a tool with a scope that had never been granted by the original root — because the "root" it verified against was now a re-rooted document from the fallback path, and the re-rooted document's key had signed a *different* `A` credential that happened to be in `C`'s cache from a prior federation sync. The runtime logged `chain_verified=true, resolver=secondary, latency_ms=612`. No anomaly. The re-rooting was invisible because the verifier's contract was "does the chain terminate in a document that validates the terminal issuer," not "does the chain terminate in the *same* document the delegating agent observed at issuance time." ## Condition of Validity The invariant that was violated: **a delegated credential chain is authoritative only if every hop's issuer DID resolves to a document whose controller set is transitively consistent with the root the delegating agent committed to at delegation time.** Two conditions must both hold for a chain to be valid in the operational sense: 1. **Root pinning.** The delegating agent must bind the terminal issuer DID to a specific document digest (or a controller-set fingerprint), not merely to the DID string. The DID string is a *locator*; the document is the *identity*. Failover changes the locator's resolution path, and without pinning, changes the identity. 2. **Resolution provenance in the proof.** The verifier must record *which resolver* produced each document and reject chains assembled across resolver boundaries unless the boundary is explicitly authorized. A chain that verifies hop-by-hop against documents from three different resolvers is not one chain; it is three fragments that happen to interlock. The subtle part: `did:web` and `did:key` have no ledger to appeal to. There is no global ordering that says "this document is the real one." The only defense is that the *consumer* of the chain remembers what it saw and refuses to accept a different document under the same DID. That memory is the invariant. It is also exactly what failover logic discards, because failover is designed to forget the failed path and use the working one. ## Decision Boundary The boundary is between **resolution retry** and **identity re-establishment**. These look identical at the transport layer — both are "call resolver, get document, proceed" — and they are categorically different at the identity layer. - **Retry** (same resolver, transient failure): the identity commitment is unchanged; the document must match the pinned digest or the retry fails closed. Safe to automate. - **Re-establishment** (different resolver, or same resolver returning a different document): the identity commitment is *under question*. This must not be silent. It requires either (a) the new document matching a pinned digest from a prior observation, or (b) an out-of-band authorization that the new controller set is acceptable. The decision rule the runtime should have applied: *if the resolved document's digest differs from any previously observed digest for that DID within the agent's trust window, halt the chain and surface a re-rooting event — do not proceed on signature validity alone.* The runtime instead applied: *if signatures verify, proceed.* That rule is correct only under the assumption that resolution is stable, which failover explicitly violates. A second boundary: **cached credentials from prior federation syncs are not neutral.** The re-rooted document's key had signed a credential that was already in `C`'s cache. Cache entries carry an implicit issuer-document binding that must be invalidated when the issuer's document digest changes. A credential cache keyed only by `(issuer DID, subject DID)` will serve stale authority across a re-rooting. It must be keyed by `(issuer DID, issuer document digest, subject DID)`. ## Operational Effect The blast radius is delegated authority escalation without any signature forgery. An attacker who controls a fallback resolver — or who can induce the primary to fail — can re-root a chain to a controller set they hold, and every cryptographic check in the pipeline will pass. The agent's own logs will show a clean verification. This is worse than a failed verification, because failed verification triggers alarms and clean verification does not. Concretely, the guardrails that bound this: - **Pin root documents by digest at delegation time**, and carry the digest in the credential's `termsOfUse` or a custom `rootCommitment` field so downstream verifiers can check it without out-of-band state. - **Record resolver provenance per hop** and fail closed on cross-resolver chains unless the resolver set is explicitly federated with a shared trust root. - **Key credential caches by issuer document digest**, not issuer DID alone, and invalidate on digest change. - **Treat any digest change for a pinned DID as an identity event**, not a resolution event: halt, log, require re-authorization. The halt is the invariant; the log is the evidence. The general lesson for agent identity: a DID is a name, not an identity. Identity is the name plus the document you committed to. Failover is a mechanism for preserving availability of the *name*; it must never be allowed to silently change the *document*. The moment a verifier accepts "a document" where it previously required "the document," the chain's authority is no longer rooted in the delegating agent's intent — it is rooted in whoever answered the resolver last. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class ReRootingDetected(RuntimeError): """Raised when a DID resolves to a document digest inconsistent with the pinned commitment.""" pass @dataclass class DIDDocument: did: str controller_keys: tuple[str, ...] resolver_id: str def digest(self) -> str: material = f"{self.did}|{','.join(sorted(self.controller_keys))}".encode() return hashlib.sha256(material).hexdigest() @dataclass class IdentityPin: did: str committed_digest: str trust_window_open: bool = True @dataclass class ChainVerifier: pins: dict[str, IdentityPin] = field(default_factory=dict) observed: dict[str, set[str]] = field(default_factory=dict) def pin_root(self, doc: DIDDocument) -> None: self.pins[doc.did] = IdentityPin(did=doc.did, committed_digest=doc.digest()) self.observed.setdefault(doc.did, set()).add(doc.digest()) def resolve_and_check(self, doc: DIDDocument, expected_resolver: Optional[str]) -> None: digest = doc.digest() self.observed.setdefault(doc.did, set()).add(digest) pin = self.pins.get(doc.did) if pin is None: raise ReRootingDetected( f"no root commitment for {doc.did}; refusing to establish authority" ) if digest != pin.committed_digest: raise ReRootingDetected( f"re-rooting: {doc.did} resolved to {digest[:12]} " f"but committed to {pin.committed_digest[:12]} " f"via resolver={doc.resolver_id}" ) if expected_resolver is not None and doc.resolver_id != expected_resolver: raise ReRootingDetected( f"cross-resolver chain: {doc.did} resolved via {doc.resolver_id}, " f"expected {expected_resolver}" ) def verify_chain(self, docs: list[DIDDocument], resolver: str) -> None: for doc in docs: self.resolve_and_check(doc, expected_resolver=resolver) def demo() -> None: verifier = ChainVerifier() root = DIDDocument( did="did:web:ops.example", controller_keys=("z6Mk-root-key",), resolver_id="primary", ) verifier.pin_root(root) # Failover returns a valid document with a different controller set. re_rooted = DIDDocument( did="did:web:ops.example", controller_keys=("z6Mk-attacker-key",), resolver_id="secondary", ) verifier.verify_chain([re_rooted], resolver="secondary") # raises if __name__ == "__main__": demo() ```