# Which invariants prevent delegation-token replay from silently rebinding an agent's identity across AAIF trust domains **Date of Record:** 2026 December 4 **Scope:** Applies to federated agent-to-agent handoffs where an orchestrator in trust domain A presents a short-lived delegation token (SDT) to a peer in trust domain B, and B mints or forwards capability warrants on behalf of the delegated subject. Does not cover single-domain bearer-token auth, long-lived service credentials, or human SSO federation. ## Core Distinction The failure here is not token *forgery* and not token *expiry*. It is **identity rebinding under clock and key skew**: a delegation token that is cryptographically valid, unexpired by its own `exp`, and correctly signed can still resolve to a *different subject* in the receiving trust domain than the one the issuer intended. The distinction that matters is between **token validity** (signature, `nbf`/`exp`, audience) and **subject continuity** (the guarantee that the `sub` claim, once mapped into domain B's namespace, denotes the same principal for the entire lifetime of the delegated warrant chain). Most implementations check the first and assume the second. The invariant that actually holds the system together is that *the subject binding is immutable across every hop of the warrant chain and is anchored to a key that the verifier independently pins, not to a claim the presenter supplies.* ## What Was Observed An orchestrator agent `orch-a` in domain `A` (issuer `aaif://A/orch`) delegated a research subtask to `agent-b` in domain `B`. The SDT was issued with `sub = "aaif://A/orch/researcher-7"`, `aud = "aaif://B/agent-b"`, `exp = issue + 90s`, and a `cnf` (confirmation) thumbprint binding the token to `orch-a`'s ephemeral DPoP key. Domain B's gateway performed the standard checks: signature against A's published JWKS, `aud` match, `exp`/`nbf` within a 120-second leeway window, and `cnf` match against the presented proof-of-possession. All passed. The problem surfaced 40 seconds later. Domain B caches the resolved subject for the duration of the delegated warrant it mints downstream (`warrant.exp = now + 300s`, deliberately longer than the SDT's remaining life of ~50s). A's key-rotation job rotated the ephemeral signing key for `researcher-7` mid-task. The *old* JWKS entry was retained for verification (correct), but B's subject-resolution cache keyed on `(issuer, sub)` was *not* invalidated, and B had no binding from the cached subject record to the specific key thumbprint. When `orch-a` re-presented a fresh SDT signed by the *new* key for the same `sub`, B's gateway hit the cache, matched `(A, researcher-7)`, and reused the prior subject mapping — including the prior `cnf` thumbprint — for the new warrant. Two distinct key holders were now conflated under one subject record. A subsequent auditor replay of the warrant chain could not distinguish which key actually authorized the 300s warrant, because the warrant carried `sub` but only a *reference* to the confirmation key, resolved through the mutable cache. The trace: (1) SDT₁ issued, key K₁, `cnf=thumb(K₁)`; (2) B verifies, caches `(A, sub) → {subject, thumb(K₁)}`; (3) A rotates to K₂, retains K₁ in JWKS; (4) SDT₂ issued, key K₂, `cnf=thumb(K₂)`, same `sub`; (5) B's cache hit returns `thumb(K₁)`; (6) B mints warrant W with `cnf_ref → thumb(K₁)` while the live presenter holds K₂; (7) W validates for 300s against a key the presenter no longer controls — and, worse, a *third* party who still holds K₁ can satisfy W's proof-of-possession. Subject continuity broke silently; nothing threw. ## Condition of Validity The rebinding is only possible when three conditions co-occur, and the invariant is only *required* when all three hold: 1. **Warrant lifetime exceeds SDT lifetime.** If `warrant.exp ≤ sdt.exp`, the warrant cannot outlive the token that justified it, and key rotation after `sdt.exp` cannot rebind a live warrant. The moment an implementer extends downstream warrant life beyond the delegating token's remaining validity, they have created a window where the anchoring token is gone but the derived authority persists. 2. **Subject resolution is cached independently of the confirmation key.** A cache keyed on `(issuer, sub)` alone — without the key thumbprint in the key — is the direct enabler. The cache must be keyed on `(issuer, sub, thumb(cnf))`, or the confirmation key must be embedded in the warrant rather than referenced. 3. **Issuer retains old keys for verification while accepting new keys for the same `sub`.** This is correct, standard key-rotation hygiene. The bug is not the rotation; it is that rotation is treated as a *verification* concern and not a *subject-identity* concern. The two must be coupled. Where any one condition is absent, the failure cannot manifest. Where all three are present, the failure is not probabilistic — it is deterministic on the first rotation that occurs inside the warrant window. ## Decision Boundary The boundary is drawn at **warrant minting time**, not at verification time. The rule: - A warrant whose `exp` exceeds the presenting SDT's `exp` MUST embed the confirmation key material (`jkt` thumbprint) *inline* in the warrant, not by reference to any cache or resolver. Referenced keys are mutable; inline keys are not. - The subject-resolution cache MUST be keyed on `(issuer, sub, jkt)`. A cache hit that matches `(issuer, sub)` but not `jkt` is a **rebinding event** and MUST fail closed, not fall through to a re-resolve. - Key rotation MUST emit a subject-continuity event that invalidates any warrant minted under the retiring key *if and only if* that warrant's `exp` exceeds the retiring key's `not_after`. Warrants that expire with the key are safe to leave; warrants that outlive the key are not. The guardrail is a single invariant: **for every live warrant, `warrant.cnf_jkt` must be resolvable to a key whose `not_after ≥ warrant.exp`.** If the anchoring key expires before the warrant, the warrant is over-anchored and must be re-minted or revoked. This is checkable at mint time and re-checkable at every verification, and it is the only condition that provably bounds the rebinding window. ## Operational Effect Without the invariant, the blast radius is bounded by the warrant lifetime, not the token lifetime — which is exactly backwards from the security model's intent. A 90-second delegation token silently authorizes a 300-second warrant, and the 210-second gap is a window in which authority has decoupled from the key that justified it. Auditors replaying the chain see a valid `sub` and a valid `cnf_ref` and conclude continuity held, because the reference resolves *at replay time* to whatever the cache currently says. The replay is not a proof of what happened; it is a proof of what the mutable state currently claims happened. With the invariant, the failure converts from *silent rebinding* to *loud mint-time rejection*: the warrant mint throws because `jkt` is not pinned or because the anchoring key's `not_after` precedes `warrant.exp`. The orchestrator must either shorten the warrant to fit inside the SDT's remaining life or re-delegate under a fresh key with a fresh subject record. Either way, the identity that authorized the warrant is the identity that can satisfy its proof-of-possession for the warrant's entire life — which is the only definition of subject continuity that survives key rotation. ```python from dataclasses import dataclass from typing import Optional class SubjectRebindingError(RuntimeError): """Raised when a warrant's anchoring key cannot be proven continuous with the delegated subject for the warrant's full lifetime.""" @dataclass(frozen=True) class DelegationToken: issuer: str subject: str audience: str exp: int cnf_jkt: str # confirmation key thumbprint, inline @dataclass(frozen=True) class Warrant: subject: str exp: int cnf_jkt: str # MUST be inline, never a cache reference @dataclass(frozen=True) class KeyRecord: jkt: str not_after: int # absolute expiry of the anchoring key def mint_warrant( sdt: DelegationToken, requested_exp: int, anchoring_key: Optional[KeyRecord], subject_cache_key: tuple, ) -> Warrant: # Invariant 1: anchoring key must be pinned inline, not resolved via cache. if anchoring_key is None: raise SubjectRebindingError( f"no pinned key for subject {sdt.subject}; refusing cache-resolved binding" ) # Invariant 2: the cache key must include the confirmation thumbprint. if subject_cache_key != (sdt.issuer, sdt.subject, sdt.cnf_jkt): raise SubjectRebindingError( f"subject cache key {subject_cache_key} omits jkt; " f"rebinding risk for {sdt.subject}" ) # Invariant 3: the anchoring key must outlive the warrant it authorizes. if anchoring_key.not_after < requested_exp: raise SubjectRebindingError( f"warrant exp {requested_exp} outlives anchoring key " f"{anchoring_key.jkt} (not_after={anchoring_key.not_after}); " f"over-anchored warrant would permit silent rebinding" ) # Invariant 4: warrant must not outlive the delegating token's subject binding # unless the inline key is provably continuous. if requested_exp > sdt.exp and anchoring_key.jkt != sdt.cnf_jkt: raise SubjectRebindingError( f"warrant exp {requested_exp} > sdt exp {sdt.exp} with mismatched " f"jkt {anchoring_key.jkt} != {sdt.cnf_jkt}" ) return Warrant(subject=sdt.subject, exp=requested_exp, cnf_jkt=anchoring_key.jkt) ```