# What happens when an instance mutates its SPIFFE SVID mid-task and the peer's cached trust anchor silently outlives the bundle rotation **Date of Record:** 2026 November 28 **Scope:** Applies to federated agent meshes where each LLM agent instance is bound to a SPIFFE workload identity (SVID) issued by a SPIRE server, and cross-org peers cache the remote trust bundle plus a per-SVID authorization decision. Does not apply to single-trust-domain meshes where all agents share one SPIRE server and rotation is atomic, nor to stateless request/response tool calls that re-verify identity on every hop. ## Core Distinction The distinction that matters is between **identity freshness** and **authorization freshness**. SPIFFE/SPIRE gives you a hard guarantee on the former: an SVID carries a `not_after` and a bundle carries a refresh hint, and the agent's local attestation agent will rotate the key material before expiry. It gives you *no* guarantee on the latter. When a federated peer agent validates an incoming SVID, it typically does two things in sequence: (1) verify the JWT-SVID signature against a cached copy of the remote trust bundle, and (2) map the SPIFFE ID (`spiffe://org-a/mesh/agent/planner`) to a capability warrant it holds in its own state. Step 1 has a cryptographic expiry. Step 2 has whatever TTL the peer's memory system assigned it — often "for the duration of the task," which for a long-running agent is unbounded. The failure mode is not "expired SVID accepted." It is subtler: the SVID is valid *and* freshly rotated, but the *authorization binding* attached to that SPIFFE ID was minted against a prior incarnation of the workload — a prior model version, a prior tool manifest, a prior prompt-injection exposure — and the peer never re-derives it because the SPIFFE ID string did not change. Identity continuity is preserved exactly *because* the identifier is stable, and that stability is what lets a stale warrant survive a security-relevant mutation on the other side of the federation. ## What Was Observed A two-org federation: Org A runs a planner agent (`spiffe://org-a/mesh/agent/planner`) that delegates subtasks to Org B's executor agent (`spiffe://org-b/mesh/agent/executor`) over an A2A-style transport. The executor caches, per remote SPIFFE ID, a `PeerWarrant` record: the set of tool scopes the peer is permitted to invoke, plus the `bundle_serial` and `svid_serial` observed at the time the warrant was minted. During a long-horizon task (roughly 40 minutes of wall-clock, spanning ~200 tool calls), the following sequence occurred: 1. Org A's planner was redeployed mid-task to pick up a patched tool manifest — specifically, a `shell.exec` tool was removed from its advertised capability set after an injection incident in a sibling task. SPIRE rotated its SVID as part of the workload restart. New `svid_serial`, same SPIFFE ID. 2. The executor's cached `PeerWarrant` still listed `shell.exec` in the planner's permitted scopes, because the warrant's re-derivation trigger was keyed on `svid_serial` change *observed at the executor* — and the executor only re-reads `svid_serial` when it performs a fresh JWT-SVID verification, which it skips for cached sessions. 3. The planner, running its *old* in-context tool schema (the context window still held the pre-redeploy manifest from turn 3 of the task), emitted a `shell.exec` call. The executor's warrant check passed — the cached scope was still present. The call executed under Org B's authority. 4. No cryptographic check failed. The SVID was valid. The bundle was current. The signature verified. The failure was entirely in the authorization layer, masked by the correctness of the identity layer. The tell, in retrospect, was a `bundle_serial` mismatch that nobody was checking: the executor's cached warrant recorded `bundle_serial=4471`, while the incoming JWT-SVID's `iss` chain resolved against `bundle_serial=4473`. The executor's verifier had been configured to accept any bundle whose root chain validated, and both serials chained to the same federation root, so the mismatch was invisible to the signature check. ## Condition of Validity This failure requires all of the following to hold simultaneously; remove any one and the mechanism does not fire: - **Stable SPIFFE ID across a security-relevant mutation.** The workload's identity string must survive a change to its capability surface (tool manifest, model version, prompt template, sandbox policy). This is the *normal* case in SPIRE, because SPIFFE IDs are derived from selectors like `k8s:ns:mesh` + `k8s:sa:planner`, not from image digest or config hash. If your registration entries pin on `docker:image_id`, the ID changes and the warrant is invalidated for free — but you also lose continuity for benign restarts, which is why most operators don't do this. - **Peer-side warrant caching keyed on identity, not on capability.** If the executor re-fetches the planner's advertised capabilities on every call, the removed `shell.exec` disappears from the warrant at the next call. The failure requires the warrant to be a *snapshot* rather than a *live view*. - **In-context schema staleness on the calling side.** The planner must still believe it has `shell.exec` in its tool list. This happens whenever the tool schema is loaded into the context window once at task start and not re-injected after a redeploy — i.e., mid-task checkpoint/resume that restores conversation state but not tool-binding state. - **Bundle serial not enforced as a monotonic floor.** If the executor rejects any JWT-SVID whose `bundle_serial` is *older* than its cached value, rotation is caught. If it accepts any serial that chains to the federation root, rotation is invisible. The window closes when any of: the task ends and the session cache is dropped; the executor's warrant TTL (if any) expires; or the planner's context is truncated past the stale tool schema. ## Decision Boundary The architectural invariant required is: **a peer warrant must be a function of `(spiffe_id, capability_manifest_hash, bundle_serial)`, not of `spiffe_id` alone.** Concretely, the executor's cache key must include a hash of the remote agent's advertised capability manifest, and the manifest must be re-fetched whenever the observed `bundle_serial` advances. This turns the silent failure into a cache miss, which forces re-derivation. The secondary invariant is on the *calling* side: **tool schema must be re-bound at every checkpoint/resume boundary, and a call to a tool absent from the current manifest must fail closed at the caller, not be delegated and rejected at the callee.** The planner should have known `shell.exec` was gone; it didn't, because its resumed context was a serialized conversation, not a serialized capability binding. The boundary you must draw explicitly: *identity continuity is not authorization continuity.* SPIFFE is designed to give you a stable name for a workload that may restart, reschedule, and re-image. That stability is a feature for service discovery and a hazard for authorization caching. The decision boundary is whether your warrant cache treats the SPIFFE ID as a *subject key* (stable, dangerous) or as one input to a *composite key* that includes the mutable capability surface (correct). A third, softer boundary: bundle serial must be treated as a monotonic floor per peer, not merely as a chain-validation input. An SVID that verifies against a *newer* bundle than the one your warrant was minted under is a signal to re-derive, not a signal to proceed. ## Operational Effect When the invariant is violated, the failure is *silent and post-hoc invisible*. Audit logs show a valid SVID, a valid signature, a valid bundle chain, and an authorized tool call. The only artifact distinguishing the bad call from a good one is the `bundle_serial` recorded in the warrant versus the one in the SVID's issuer chain — a field most verifiers log but few compare. Post-incident forensics must reconstruct the rotation timeline from SPIRE server logs, because the agent-side logs contain no anomaly. When the invariant holds, the observable effect is a burst of cache misses at every bundle rotation, followed by re-derivation and (in the failure case above) a `capability_manifest_mismatch` rejection at the executor. This is *loud* and *early*: the planner's second call after redeploy fails, the task surfaces a structured error, and the orchestrator can re-plan against the corrected manifest rather than executing a removed tool under stale authority. The cost of the guardrail is a small amount of extra round-trip traffic on rotation events (one manifest fetch per peer per bundle advance) and a slightly larger warrant cache key. The cost of omitting it is an authorization decision that outlives the security posture it was minted against, with no cryptographic signal that anything is wrong. The deeper lesson for agent-mesh designers: SPIFFE solves *who is this workload*, and it solves it well across restarts. It does not solve *what is this workload currently allowed to do*, and the temptation to conflate the two is strongest precisely in long-horizon tasks where re-derivation is expensive and the SPIFFE ID's stability feels like a license to cache. It is not. Bind your warrants to the mutable surface, treat bundle serial as a floor, and re-inject tool schemas at every resume boundary. ```python from dataclasses import dataclass from typing import Optional class StaleFederatedWarrantError(RuntimeError): """Raised when a peer warrant outlives the capability surface it was minted against.""" pass @dataclass(frozen=True) class Svids: spiffe_id: str svid_serial: int bundle_serial: int capability_manifest_hash: str @dataclass(frozen=True) class PeerWarrant: spiffe_id: str bundle_serial: int capability_manifest_hash: str granted_scopes: frozenset def verify_peer_warrant( incoming: Svids, cached: Optional[PeerWarrant], current_manifest_hash: str, ) -> PeerWarrant: if cached is None: # No warrant: caller must mint one from a fresh manifest fetch. return PeerWarrant( spiffe_id=incoming.spiffe_id, bundle_serial=incoming.bundle_serial, capability_manifest_hash=current_manifest_hash, granted_scopes=frozenset(), # populated by minting flow ) # Invariant 1: bundle serial is a monotonic floor per peer. if incoming.bundle_serial < cached.bundle_serial: raise StaleFederatedWarrantError( f"peer {incoming.spiffe_id} presented bundle_serial " f"{incoming.bundle_serial} older than cached {cached.bundle_serial}; " f"possible replay or rollback" ) # Invariant 2: warrant must be keyed on the mutable capability surface, # not on the stable SPIFFE ID alone. if incoming.capability_manifest_hash != cached.capability_manifest_hash: raise StaleFederatedWarrantError( f"peer {incoming.spiffe_id} capability manifest changed " f"({cached.capability_manifest_hash} -> " f"{incoming.capability_manifest_hash}); cached warrant is stale, " f"re-derive before authorizing" ) # Invariant 3: a bundle advance invalidates the warrant even if the # manifest hash happens to match, because rotation implies a workload # lifecycle event we have not observed. if incoming.bundle_serial > cached.bundle_serial: raise StaleFederatedWarrantError( f"peer {incoming.spiffe_id} advanced bundle " f"{cached.bundle_serial} -> {incoming.bundle_serial}; " f"warrant must be re-derived under the new bundle" ) return cached def authorize_tool_call( incoming: Svids, cached: Optional[PeerWarrant], current_manifest_hash: str, requested_scope: str, ) -> None: warrant = verify_peer_warrant(incoming, cached, current_manifest_hash) if requested_scope not in warrant.granted_scopes: raise StaleFederatedWarrantError( f"scope {requested_scope!r} not granted to {incoming.spiffe_id} " f"under manifest {warrant.capability_manifest_hash}" ) ```