# What happens when an instance accepts a pairwise DID handshake whose verifiable credential chain validates cryptographically but whose issuer trust anchor was rotated mid-session **Date of Record:** 2026 November 26 **Scope:** Applies to federated agent deployments where an agent instance authenticates to a peer in another trust domain via a pairwise DID handshake and presents a Verifiable Credential (VC) chain that terminates in an org-level trust anchor (DID document or trust registry entry). Does not apply to single-org deployments or to sessions where the trust anchor is pinned for the lifetime of the process and never re-resolved. ## Core Distinction There are two distinct notions of "the credential is valid" in a cross-org federation, and conflating them is the failure: 1. **Chain-validity** — every signature in the VC chain verifies against the public key material embedded in the issuer's DID document *at verification time*, and the pairwise DID binding (`did:peer` or `did:key` derived from the handshake) holds. 2. **Anchor-validity** — the root issuer in that chain is still authorized to issue for the claimed scope *in the verifier's trust registry*, under the registry state the verifier is currently holding. A mid-session trust anchor rotation (issuer key compromise response, org split, registry re-issuance, or scope narrowing) breaks anchor-validity while leaving chain-validity intact for any credential signed before the rotation. An agent that checks chain-validity at handshake time and then caches the resulting authorization for the session has silently converted a point-in-time cryptographic check into a durable authorization grant — but the grant's *authority* was revoked underneath it. The pairwise DID handshake makes this worse, not better: pairwise DIDs are designed to be stable and unlinkable, so the peer identity the agent is talking to does not change when the anchor behind it is rotated. The handshake continues to succeed. The credential continues to verify. The agent continues to act on authority that no longer exists. ## What Was Observed A federated procurement agent (Org A) established a session with a supplier agent (Org B) at 09:14. The handshake was a standard pairwise DID exchange: Org B presented a `did:peer` derived from a key agreement, plus a VC chain — B's operational credential signed by B's org DID, B's org DID document signed by the federation trust registry entry, and the registry entry signed by the federation root. All signatures verified. The pairwise binding matched the key agreement transcript. Org A's verifier resolved the registry entry, confirmed the root in its pinned trust store, and issued a session capability token scoped to `procurement.quote.submit` with a 4-hour TTL. At 11:02, the federation root rotated its signing key and re-issued the trust registry. The re-issuance *narrowed* Org B's scope: the registry entry for Org B's org DID was re-signed with a `scope` claim that no longer included `procurement.quote.submit` (B had been downgraded pending an audit of a separate incident). Org A's verifier did not re-resolve the registry — its cache TTL for registry entries was 24 hours, independent of the session token TTL. At 11:40, Org B's agent submitted a quote. Org A's gateway checked the session capability token: valid, unexpired, scoped correctly. The quote was accepted and entered the procurement ledger. The audit trail showed a fully chain-valid credential and a fully valid session token. The authorization was nonetheless void: at the moment of the action, no live registry entry granted Org B that scope. The failure was not detected until a quarterly reconciliation pass compared ledger entries against re-resolved registry snapshots and flagged 14 quotes submitted in the 38-minute window between rotation and cache expiry across three federated agents. The non-obvious part: **the pairwise DID handshake masked the rotation**. Because the pairwise identifier is intentionally decoupled from the org DID and stable across key rotations (that is the point of pairwise DIDs — unlinkability and stability), the peer identity presented at 11:40 was byte-identical to the one at 09:14. Nothing in the handshake transcript signaled that the anchor behind it had changed. A verifier keyed on "did the peer identity change" would have seen zero signal. A verifier keyed on "did the credential chain still verify" would also have seen zero signal, because B's operational credential was still signed by B's org DID and B's org DID document was still signed by *a* registry entry — the old one, which the verifier had cached. ## Condition of Validity The invariant that was violated is: > **For any action authorized under a federated session, the trust anchor backing the session's credential chain MUST be re-validated against the verifier's current registry state at or before the moment of action, and the session's authorization scope MUST be the intersection of (scope granted at handshake) and (scope currently permitted by the live registry entry).** Two conditions make this invariant enforceable and its violation detectable: - **The registry entry must carry a monotonically increasing `version` and a `valid_from`/`valid_until` window**, so a verifier holding a cached entry can determine whether the entry it holds is still the current one without a full re-resolution on every action. Without a version, "is my cache stale" is unanswerable. - **The session capability token must carry the `registry_version` it was minted against**, not just the scope. A token minted against registry v41 that is presented while the live registry is v42 is a token whose scope must be re-derived, not merely checked for expiry. The invariant does *not* require re-resolving the full chain per action (that would defeat the point of session tokens). It requires that the *anchor binding* — the (issuer DID, registry version, scope) tuple — be re-checked against a registry state that the verifier can prove is current. A version vector or a short-TTL registry cache with a `must-revalidate` flag on rotation is sufficient. A 24-hour blind cache is not. ## Decision Boundary The boundary is between **anchor freshness** and **session liveness**, and the two must not share a TTL. - If the verifier's registry cache TTL is *shorter than or equal to* the session token TTL, the worst-case window of stale authorization is bounded by the cache TTL, and the invariant holds approximately. - If the registry cache TTL is *longer than* the session token TTL (the observed case: 24h cache vs 4h token), the session token can outlive the registry entry it was minted against, and the invariant fails silently. The token is a promise about a registry state that may no longer exist. - If the registry entry carries a `version` and the token carries the version it was minted against, the verifier can *detect* the mismatch at action time even with a long cache, by comparing the token's version to the cached entry's version and refusing if the cached entry is older than the token. This is the guardrail: **a session token must be rejected if the verifier's cached registry entry is older than the entry the token was minted against** — i.e., the token cannot be used to *extend* the authority of a stale cache. The boundary condition that triggers the failure: rotation occurs, verifier cache is not invalidated (no push channel, or push channel dropped), session token TTL has not elapsed, and the peer presents the same stable pairwise DID. All four must hold. In practice all four hold routinely in federations without a registry push channel. ## Operational Effect The operational effect is a class of **ghost authorization**: actions that are fully cryptographically valid, fully auditable as valid, and nonetheless unauthorized. The audit trail is not wrong about what it records (the signatures did verify, the token was in scope at mint time); it is wrong about what it *implies* (that the authority existed at action time). Reconciliation passes that compare ledger entries to re-resolved registry snapshots will find these, but only after the fact, and only if the registry retains historical versions. The second-order effect is on **revocation propagation**. A pairwise DID handshake is designed so that the peer identity survives key rotation — that is its virtue for unlinkability and its liability for revocation. An agent that treats "the pairwise DID is unchanged" as evidence of "the peer's authority is unchanged" has inverted the design intent: the DID's stability is precisely what makes it useless as a revocation signal. Revocation must travel on the anchor channel (registry version, credential status list, or an explicit revocation VC), never on the identity channel. The guardrail that bounds this: **session tokens must be version-bound to the registry entry that authorized them, and the verifier must re-check the registry version at action time against a cache it can prove is not older than the token.** Where a push channel exists, rotation must push-invalidate the cache; where it does not, the cache TTL must be strictly less than the session token TTL, and the token must carry `registry_version` so that a stale cache cannot silently extend authority. The pairwise DID handshake must be treated as an identity-stability mechanism and never as an authority-stability mechanism. ```python from dataclasses import dataclass from typing import Optional class StaleAnchorAuthorizationError(RuntimeError): """Raised when a session token's registry binding is older than the verifier's cached registry entry, or when the cached entry cannot be proven current relative to the token's mint-time version.""" @dataclass(frozen=True) class RegistryEntry: issuer_did: str version: int scope: frozenset[str] valid_until: float # epoch seconds @dataclass(frozen=True) class SessionToken: pairwise_did: str issuer_did: str scope: frozenset[str] registry_version: int # version the token was minted against expires_at: float def authorize_action( token: SessionToken, action_scope: str, cached_entry: Optional[RegistryEntry], now: float, ) -> None: # 1. Session liveness. if now >= token.expires_at: raise StaleAnchorAuthorizationError( f"session token for {token.pairwise_did} expired at {token.expires_at}" ) # 2. Anchor presence. A missing cache entry is not "trust the token"; # it is "cannot prove anchor-validity" and must fail closed. if cached_entry is None: raise StaleAnchorAuthorizationError( f"no cached registry entry for issuer {token.issuer_did}; " f"cannot validate token minted against v{token.registry_version}" ) # 3. Anchor freshness: the cache must not be older than the token's # mint-time version. A token cannot extend a stale cache's authority. if cached_entry.version < token.registry_version: raise StaleAnchorAuthorizationError( f"cached registry entry v{cached_entry.version} is older than " f"token mint-time v{token.registry_version} for " f"{token.issuer_did}; re-resolve before authorizing" ) # 4. Anchor currency: if the cache is newer than the token, the token's # scope may have been narrowed by rotation. Re-derive scope as the # intersection of mint-time scope and live scope. if cached_entry.version > token.registry_version: effective_scope = token.scope & cached_entry.scope else: effective_scope = token.scope # 5. Anchor validity window. if now >= cached_entry.valid_until: raise StaleAnchorAuthorizationError( f"registry entry v{cached_entry.version} for " f"{token.issuer_did} lapsed at {cached_entry.valid_until}" ) # 6. Scope check against the live-derived scope, not the mint-time scope. if action_scope not in effective_scope: raise StaleAnchorAuthorizationError( f"action {action_scope!r} not in effective scope " f"{sorted(effective_scope)} for {token.issuer_did} " f"(token v{token.registry_version}, live v{cached_entry.version})" ) ```