# Which invariants prevent federated agent warrant replay across trust-anchor rotation boundaries in SPIFFE+VC handoffs **Date of Record:** 2026 November 25 **Scope:** Applies to cross-organization agent federation where an originating agent (Org A) mints a Verifiable Credential (VC) warrant bound to a SPIFFE-style workload identity (SVID) and hands it to a downstream agent (Org B) that re-verifies before acting. Does not cover single-org intra-cluster mTLS, nor pure OAuth token exchange without VC binding. ## Core Distinction The failure is not "expired credential" or "untrusted issuer." It is **warrant-to-identity re-binding across a trust-anchor rotation window**. When Org B's federation resolver rotates its trust anchor for Org A (key rollover, root CA change, DID document update), the verifier re-evaluates the *chain* but not the *subject binding*. A VC whose `credentialSubject.id` was a SPIFFE ID under the old trust domain root still validates cryptographically against the new anchor if the issuer key survived the rotation — and the downstream agent then executes an action the *original* workload was authorized for, but which the *new* workload (or a replayed copy) should not be able to invoke. The invariant that fails is: **warrant validity must be a function of (issuer chain, subject SVID, audience, nonce) evaluated atomically at a single trust-anchor epoch**, not of the issuer chain alone. ## What Was Observed In a two-org federation (Org A = `spiffe://a.example/agent/orchestrator`, Org B = `spiffe://b.example/agent/executor`), Org A rotated its intermediate signing key at T0 while keeping the root anchor stable. Org B's resolver cached the *old* intermediate JWKS for 300s (standard TTL). During the window [T0, T0+300s]: 1. Org A minted a fresh warrant `W1` at T0+10s, signed by the *new* intermediate, bound to subject `spiffe://a.example/agent/orchestrator` and audience `spiffe://b.example/agent/executor`, with `nonce=N1`. 2. Org B's verifier, using cached JWKS, failed signature check on `W1` and — critically — the agent's retry logic re-submitted the *previously cached* `W0` (same subject, audience, but `nonce=N0`, issued at T0-5s, still within `exp`). 3. `W0` verified successfully against the *stale cached* intermediate. The executor ran the action. 4. Meanwhile a second downstream agent in Org B, on a fresh resolver cache, received `W0` via a peer relay and *also* verified it — replaying the same warrant twice under two different trust-anchor states. The observable signature: **one logical warrant (`nonce=N0`) executed twice, with two different `(anchor_epoch, verification_result)` tuples, both returning `valid=true`.** No error was raised. The audit log showed two successful verifications of the same nonce because nonce-replay state was partitioned per-resolver-instance, not per-trust-domain. ## Condition of Validity The atomic-binding invariant holds only when all four of the following are enforced as a single transaction: - **Anchor epoch pinning:** the `(issuer_chain_hash, anchor_epoch)` pair is captured at the start of verification and the subject SVID's `spiffe://` trust domain must resolve under *that same epoch*. A rotation mid-verification invalidates the attempt (must restart), never silently re-resolves. - **Nonce ledger scoped to trust domain, not resolver instance:** replay detection keys on `(issuer_trust_domain, subject_id, nonce)` with a shared durable store, so two Org B agents cannot each accept `N0`. - **Audience + subject binding re-checked against the *presented* SVID,** not the SVID embedded in the VC. If the executor's peer SVID is `spiffe://b.example/agent/executor-v2` after a workload redeploy, a VC bound to `executor` (v1) must be rejected even if the issuer chain is valid. - **Rotation grace is explicit and bounded:** a stale-JWKS window is permitted only for *verification of already-in-flight* warrants whose `iat` predates the rotation, and those warrants are marked `degraded` (logged, rate-limited, not eligible for privileged actions). Outside these conditions — e.g., rotation grace unbounded, nonce ledger per-process, or subject binding taken from the VC rather than the live SVID — the invariant is violated and replay across the boundary is possible. ## Decision Boundary The boundary is **"re-verify chain" vs. "re-bind subject."** A verifier that only re-verifies the issuer chain across a rotation will accept a warrant whose subject workload no longer exists or has been replaced. The correct decision rule: - If `anchor_epoch` changed since warrant `iat` → **reject unless** the warrant is in the in-flight degraded set *and* the action is non-privileged. - If the presented SVID's trust domain or path differs from `credentialSubject.id` → **reject** (subject drift). - If `nonce` seen under the same `(trust_domain, subject, nonce)` tuple → **reject** (replay), regardless of which resolver instance saw it first. - Otherwise → accept, and record `(anchor_epoch, chain_hash, nonce)` atomically. The non-obvious part: **the chain can be valid while the binding is stale.** Verifiers that conflate the two — treating "signature verifies" as "warrant is live" — cross the boundary silently. The guardrail is to make subject-binding a *separate, mandatory* check that fails closed on any epoch mismatch, and to make the nonce ledger a federation-wide invariant rather than a local cache optimization. ## Operational Effect Without the atomic-binding invariant, a single key rotation at Org A produces a window in which: (a) legitimately re-issued warrants fail and trigger stale-warrant retries, (b) stale warrants replay across multiple Org B executor instances, and (c) audit trails show `valid=true` for both, defeating post-hoc forensics. The blast radius is bounded by the rotation grace window and the number of resolver instances — but because agent retry loops amplify (each failed verify spawns a retry that may carry the stale warrant), the effective replay count is multiplicative, not additive. With the invariant enforced, rotation becomes a *fail-closed* event: in-flight privileged warrants are rejected and must be re-minted under the new epoch, the nonce ledger prevents cross-instance replay, and subject drift is caught before execution. The cost is a brief availability dip at rotation (bounded by grace policy) traded for replay-immunity — the correct trade for cross-org privileged actions. ```python import hashlib from dataclasses import dataclass from typing import Optional class WarrantBindingError(RuntimeError): """Raised when a federated warrant's subject/epoch binding is violated.""" pass @dataclass(frozen=True) class AnchorEpoch: trust_domain: str chain_hash: str epoch: int @dataclass(frozen=True) class Warrant: subject_id: str # spiffe://a.example/agent/orchestrator audience: str # spiffe://b.example/agent/executor nonce: str issuer_chain_hash: str issued_at_epoch: int privileged: bool class FederationVerifier: def __init__(self, nonce_ledger: set, current: AnchorEpoch, in_flight_grace: int = 0): self._ledger = nonce_ledger # shared, trust-domain scoped self._current = current self._grace = in_flight_grace def verify(self, w: Warrant, presented_svid: str) -> bool: # 1. Subject binding must match the LIVE SVID, not the VC's claim. if w.subject_id != presented_svid: raise WarrantBindingError( f"subject drift: warrant={w.subject_id} svid={presented_svid}") # 2. Audience must match the executing workload's own SVID. if w.audience != self._current.trust_domain and \ not w.audience.startswith("spiffe://"): raise WarrantBindingError(f"audience mismatch: {w.audience}") # 3. Chain must resolve under the CURRENT anchor epoch, or be an # explicitly bounded in-flight degraded warrant. epoch_delta = self._current.epoch - w.issued_at_epoch if w.issuer_chain_hash != self._current.chain_hash: if not (w.privileged is False and 0 <= epoch_delta <= self._grace): raise WarrantBindingError( f"stale chain across rotation: issued@{w.issued_at_epoch} " f"current@{self._current.epoch}") # 4. Nonce replay check scoped to (trust_domain, subject, nonce). key = (self._current.trust_domain, w.subject_id, w.nonce) if key in self._ledger: raise WarrantBindingError(f"warrant replay: nonce={w.nonce}") self._ledger.add(key) return True def execute_federated_action(verifier, warrant, presented_svid): try: verifier.verify(warrant, presented_svid) except WarrantBindingError as e: # Fail closed: never fall back to a cached/stale warrant. raise WarrantBindingError(f"federation boundary rejected: {e}") return "executed" ```