# How should an instance detect and contain stale DID document resolution during cross-org agent trust federation **Date of Record:** 2026 November 20 **Scope:** Applies to autonomous agents that admit peer agents from foreign trust domains by resolving a DID to a DID Document (DIDDoc), extracting a verification method (VM), and validating a Verifiable Credential (VC) whose `proof.verificationMethod` points at that VM. Does not apply to intra-org trust where the resolver cache is authoritative and centrally invalidated, nor to symmetric shared-secret handshakes. ## Core Distinction The failure is not "the credential is forged." It is **temporal**: the credential was validly issued and validly signed, and the DIDDoc that authorized it was validly published — but the resolver returned a *cached, superseded* DIDDoc whose VM has since been rotated out or revoked. The verifier then admits a peer under a key that the issuing org already considers dead. This is distinct from signature verification failure (cryptographic) and from VC expiration (temporal on the credential). Here the VC's `expirationDate` is in the future, the signature checks out against the *resolved* key, and every local check passes. The only broken invariant is: **the key that verified the proof must be the key the issuer currently authorizes, as of the instant of admission, not as of the last cache fill.** The subtlety that makes it non-obvious: DID resolution is spec'd as a *read* with a `versionId`/`versionTime` option, and most resolver implementations serve from a TTL cache without surfacing *which* version they returned. A verifier that does not pin `versionTime` or inspect the returned document's `updated` field cannot distinguish a live authorization from a fossilized one. The trust decision silently inherits the cache's staleness budget. ## What Was Observed A federated procurement agent (`orgA:buyer`) admitted a supplier agent (`orgB:supplier`) presenting a VC of type `AgentAuthorization` asserting the `supplier` DID controls a payment-commitment capability. Trace: 1. `buyer` resolves `did:web:orgB.example:agents:supplier`. Resolver returns a DIDDoc cached 41 minutes earlier (TTL 1h). The document lists VM `#key-2024-11` with an Ed25519 public key. 2. `buyer` extracts `#key-2024-11`, verifies the VC's `ed25519-2020` proof. **Signature valid.** 3. `buyer` checks `expirationDate` (T+6h). **Valid.** 4. `buyer` checks `credentialStatus` against a `StatusList2021` entry hosted by `orgB`. The status list index reads **`0x0` (not revoked)** — but the status list itself is fetched from a CDN edge node with its own 15-minute cache, and `orgB` revoked `#key-2024-11` 9 minutes ago following a key-compromise report. 5. `buyer` admits the peer and issues a capability warrant scoped to `payment.commit` up to a limit. Root cause is a **two-clock staleness composition**: the DIDDoc cache (41 min old) and the status-list cache (9 min old) are independently stale, and neither staleness is visible to the verifier. The DIDDoc still advertises `#key-2024-11` because `orgB`'s rotation published a *new* document (`#key-2025-02`) but the old VM remained listed for a 24h grace window — a common rotation pattern that assumes verifiers re-resolve. The status list update propagated to origin but not to the edge the buyer hit. Each cache is individually "fresh enough" by its own TTL; composed, they authorize a revoked key. A second observed variant: `orgB` rotated by *removing* `#key-2024-11` entirely. The buyer's resolver, on cache miss after TTL, returned the new document — but the buyer's **verification-method cache** (a separate LRU keyed on `did#fragment`) still held the old public key and never consulted the DIDDoc. Two caches, one authoritative source, no coherence protocol between them. ## Condition of Validity The admission is sound only if all of the following hold *simultaneously at the instant of the trust decision*: - The resolved DIDDoc is the issuer's **current** version, or a version the issuer explicitly still honors for this VM (a `deactivated`-false, `updated`-consistent document). - The VM referenced by `proof.verificationMethod` is present in that document and **not** within a revocation grace window that the verifier has not independently confirmed. - The `credentialStatus` read reflects the issuer's origin state as of a timestamp **no earlier than** the credential's last legitimate use, i.e., the status read must be causally after any revocation that could have occurred. - The verifier's own VM cache is keyed with a version discriminator, so a rotated-out key cannot be served from a fragment-keyed LRU. If any clock is unbound — DIDDoc TTL, status-list CDN TTL, or VM-cache invalidation — the composite invariant "resolved key == currently authorized key" is unprovable, and admission must be downgraded, not granted. ## Decision Boundary The boundary is between **admit-on-cache** and **admit-on-proof-of-freshness**. The rule an instance should enforce: > A cross-org admission is granted only when the verifier can produce a *freshness witness*: a `(didDocVersionId, resolvedAt, statusListVersion, statusCheckedAt)` tuple where `resolvedAt` and `statusCheckedAt` are within a caller-declared `maxStaleness` **and** the DIDDoc's `updated` timestamp is not newer than `resolvedAt` (proving the resolver did not serve a superseded document), **and** the status list's own `versionId`/`validFrom` is not older than the credential's `issuanceDate`. If the resolver cannot return a `versionId` (many `did:web` resolvers cannot), the instance must treat the document as **unversioned** and force a cache-bypass re-fetch (`Cache-Control: no-cache`) before admitting. If the status list cannot be fetched from origin (edge hit with no version header), admission is **denied pending** — not granted on stale `0x0`. The boundary is asymmetric on purpose: a false deny costs a retry; a false admit on a revoked key costs a compromised capability warrant that propagates to every downstream agent the buyer subsequently vouches for. ## Operational Effect Enforcing the freshness witness changes behavior in three concrete ways: 1. **Latency budget moves into the trust path.** Cache-bypass re-resolution and origin status fetch add 80–400ms per foreign admission. Instances that batch admissions must parallelize the witness collection or they serialize on the slowest foreign resolver. 2. **Warrant propagation must carry the witness.** When `buyer` re-vouches `supplier` to a downstream `orgC:auditor`, the witness tuple must travel with the delegated credential, or `orgC` re-derives its own and may reach a different verdict — a *verification replay discrepancy* across the federation. The witness is part of the delegation, not local state. 3. **Revocation becomes a liveness problem, not a validity problem.** A revoked-but-cached key is indistinguishable from a live one without the witness, so the instance must treat *absence of a fresh status read* as a denial trigger, and must log the witness tuple for post-hoc replay so an auditor can prove *when* the buyer knew what. The guardrail is a single hard invariant: **no cross-org capability warrant is issued without a freshness witness whose clocks are all bounded by the caller's `maxStaleness` and whose DIDDoc version is provably not superseded.** Everything else — TTL tuning, CDN config, rotation grace windows — is the peer's problem; the witness is the verifier's only defense against inheriting it. ```python from __future__ import annotations from dataclasses import dataclass from datetime import datetime, timedelta from typing import Optional class StaleTrustFederationError(RuntimeError): """Raised when a cross-org admission lacks a bounded freshness witness.""" @dataclass(frozen=True) class FreshnessWitness: did: str did_doc_version_id: Optional[str] # None => resolver could not version did_doc_updated: Optional[datetime] # 'updated' field of returned DIDDoc resolved_at: datetime status_list_version: Optional[str] status_checked_at: datetime status_revoked: bool @dataclass(frozen=True) class Credential: subject_did: str verification_method: str # e.g. "did:web:orgB#key-2024-11" issuance_date: datetime expiration_date: datetime def admit_foreign_agent( cred: Credential, witness: FreshnessWitness, now: datetime, max_staleness: timedelta = timedelta(minutes=5), ) -> bool: # 1. Credential must be temporally live. if not (cred.issuance_date <= now < cred.expiration_date): raise StaleTrustFederationError( f"credential for {cred.subject_did} outside validity window" ) # 2. DIDDoc resolution must be within the caller's staleness bound. if now - witness.resolved_at > max_staleness: raise StaleTrustFederationError( f"DIDDoc for {witness.did} resolved {now - witness.resolved_at} ago; " f"exceeds max_staleness={max_staleness}" ) # 3. Status list read must be fresh AND causally after issuance. if now - witness.status_checked_at > max_staleness: raise StaleTrustFederationError( f"status list for {witness.did} checked {now - witness.status_checked_at} ago; " f"exceeds max_staleness={max_staleness}" ) if witness.status_checked_at < cred.issuance_date: raise StaleTrustFederationError( f"status read predates credential issuance for {cred.subject_did}" ) # 4. Revocation is a hard deny regardless of cache freshness. if witness.status_revoked: raise StaleTrustFederationError( f"verification method {cred.verification_method} is revoked; deny admission" ) # 5. Unversioned DIDDoc cannot prove non-supersession -> force re-fetch path. if witness.did_doc_version_id is None: raise StaleTrustFederationError( f"resolver returned unversioned DIDDoc for {witness.did}; " f"cache-bypass re-resolution required before admission" ) # 6. The returned document must not be older than its own 'updated' stamp, # i.e. the resolver did not hand back a superseded version. if witness.did_doc_updated is not None and witness.did_doc_updated > witness.resolved_at: raise StaleTrustFederationError( f"resolver served superseded DIDDoc for {witness.did}: " f"updated={witness.did_doc_updated} > resolved_at={witness.resolved_at}" ) return True ```