# What happens when an instance's SPIFFE SVID outlives the delegating principal's authorization window **Date of Record:** 2026 November 24 **Scope:** Applies to agent instances whose workload identity is a SPIFFE SVID (X.509 or JWT-SVID) and whose authority to act is granted through a delegated authorization token minted by a human or parent principal with a shorter TTL than the SVID. Does not cover static API-key identity, mTLS-only service meshes without delegation, or cases where the SVID and the delegation token share a single issuer-controlled lifetime. ## Core Distinction There are two independent clocks in a delegated agent identity system, and conflating them is the root of the failure. The **workload identity clock** governs whether the process *is who it claims to be*: the SPIFFE SVID, rotated by the SPIRE agent, typically valid for hours. The **authorization clock** governs whether that identity *may currently act on behalf of the principal*: the delegation token (a signed JWT carrying `sub=spiffe://.../agent-7`, `act=principal:alice`, a scope, and an `exp`), typically valid for minutes. Most teams treat the SVID as the security boundary and the delegation token as a convenience header. That is backwards. The SVID proves *which agent* is calling; it says nothing about *whether the principal's grant is still live*. When the delegation token expires but the SVID does not, the agent remains cryptographically authentic, transport-valid, and mTLS-acceptable at every hop — while its authority to act for the principal is already dead. The system will happily accept calls from a ghost. ## What Was Observed An orchestration agent (`spiffe://corp/agents/orchestrator`) delegated a sub-task to a worker (`spiffe://corp/agents/worker-3`). Alice authorized the orchestrator for a 15-minute window to read from `billing-api`. The orchestrator's SVID had a 6-hour TTL. At T+14m the orchestrator minted a fresh, *downstream* delegation token for worker-3 — but the minting code copied the SVID's `exp` into the child token instead of clamping to the parent delegation's `exp`. The child token therefore claimed validity until T+6h. Trace: 1. T+15m: Alice's original grant expires. The authorization service's revocation list updates. 2. T+16m: worker-3 presents its (still cryptographically valid, wrong-`exp`) delegation token to `billing-api`. `billing-api` validates the JWT signature, checks `exp` (passes — T+6h), checks the SVID chain (passes), and **does not re-query the parent grant's liveness**. The call succeeds. 3. T+40m: a routine audit reconciles the delegation tree against the authorization service and finds worker-3 holding a token whose `act` chain terminates at a grant that expired 25 minutes ago. The reconciliation job cannot distinguish "worker-3 acted under a legitimately extended grant" from "worker-3 acted under a stale-copied `exp`," because the child token carries no reference to the *parent grant ID*, only the principal string. The failure is silent. No hop rejects the call. The identity layer is fully satisfied; the authorization layer was never consulted after mint. ## Condition of Validity The invariant that must hold is a **monotonic delegation lifetime constraint**: > For every delegation token `d` with parent grant `g`, `d.exp ≤ g.exp`, and `d` must carry `g.grant_id` such that any verifier can reconstruct the full `act` chain and re-check liveness of the terminal grant at decision time. This invariant is violated by any of three concrete conditions, all of which were present: - **Clock decoupling:** the child token's `exp` is derived from the workload identity's lifetime rather than the parent authorization's lifetime. This is the direct cause here — the minting code took `min` over the wrong pair. - **Chain truncation:** the child token records the principal (`act=principal:alice`) but drops the `grant_id`, so a verifier cannot walk back to the authorizing grant and ask "is this still live?" without out-of-band lookup that nobody performs. - **Stateless verification:** `billing-api` validates tokens statelessly (signature + `exp` + SVID chain) and never performs the online liveness check against the authorization service. Stateless verification is correct only if the `exp` is *trustworthy*, which requires the first two conditions to hold. The invariant holds only when all three are enforced together. Fixing the `exp` clamp alone leaves the truncated chain; fixing the chain alone leaves the stale `exp`. The boundary is the conjunction. ## Decision Boundary At verification time, a resource server has exactly two sound choices and one unsound one: - **Sound (stateless):** accept the token only if `exp` was provably clamped at mint to the parent grant's `exp` *and* the `act` chain is complete enough to be independently re-derived. This requires the minting service to be trusted and the chain to be self-describing. - **Sound (stateful):** on every call, resolve the terminal `grant_id` against the authorization service and reject if revoked or expired, regardless of the token's own `exp`. Cost: one lookup per call, or a bounded-TTL cache whose staleness window is itself bounded by the shortest grant TTL in the system. - **Unsound:** trust the token's `exp` because the signature is valid and the SVID checks out. This is the default behavior of nearly every JWT-validating middleware and is precisely what fails here. The decision boundary is: *does the verifier's trust in `exp` rest on a mint-time guarantee it can audit, or on an assumption it cannot check?* If the latter, the verifier must go stateful or refuse delegated tokens whose `exp` exceeds the maximum plausible grant TTL. ## Operational Effect The blast radius is a **post-expiry authority window** equal to `min(SVID TTL, copied exp) − parent grant exp`. In this incident that window was roughly 5h45m during which worker-3 could read `billing-api` as Alice with no live grant. Because the SVID remained valid, no mesh policy, mTLS check, or SPIFFE-aware authorization proxy flagged it; the calls looked identical to legitimate ones in every log except the reconciliation job, which fired 25 minutes late and could not attribute intent. Downstream consequences: audit records for the window are ambiguous (the agent was authentic but unauthorized), the delegation tree cannot be reconstructed for the affected subtree, and any action taken in the window must be treated as suspect for incident response — including actions that were, in fact, within Alice's original intent. The remediation is not "rotate the SVID faster"; it is to make the authorization clock authoritative and the identity clock subordinate, and to force every verifier of a delegated token to either audit the mint-time clamp or perform the liveness check. ## Guardrail Implementation The minting service must clamp `exp` to the parent grant and embed the full chain; the verifier must reject any token whose chain cannot be resolved to a live grant. The following enforces both at the boundary where the ghost token would otherwise be accepted. ```python import time from dataclasses import dataclass class DelegationChainError(RuntimeError): """Raised when a delegated token's authority cannot be proven live.""" pass @dataclass class Grant: grant_id: str principal: str expires_at: float revoked: bool = False @dataclass class DelegationToken: subject_svid: str act_principal: str grant_id: str # must reference the terminal parent grant expires_at: float # must be <= parent grant.expires_at signature_valid: bool def mint_child_token(parent: Grant, subject_svid: str, now: float) -> DelegationToken: """Clamp child lifetime to the parent grant, never to the SVID TTL.""" if parent.revoked or parent.expires_at <= now: raise DelegationChainError( f"cannot delegate from dead grant {parent.grant_id}" ) # The invariant: child exp is bounded by the authorization clock. child_exp = min(parent.expires_at, now + 60.0) return DelegationToken( subject_svid=subject_svid, act_principal=parent.principal, grant_id=parent.grant_id, expires_at=child_exp, signature_valid=True, ) def verify_delegated_call( token: DelegationToken, grant_lookup, now: float, max_stateless_ttl: float = 300.0, ) -> None: """Reject ghost tokens: valid SVID + valid signature is not enough.""" if not token.signature_valid: raise DelegationChainError("bad signature") if token.grant_id is None: raise DelegationChainError( "token carries no grant_id; cannot prove authority is live" ) grant = grant_lookup(token.grant_id) if grant is None: raise DelegationChainError(f"unknown grant {token.grant_id}") if grant.revoked: raise DelegationChainError(f"grant {grant.grant_id} revoked") if grant.expires_at <= now: raise DelegationChainError( f"grant {grant.grant_id} expired at {grant.expires_at}, now {now}" ) if token.expires_at > grant.expires_at: # The exact failure from the incident: exp copied from SVID, not grant. raise DelegationChainError( f"token exp {token.expires_at} exceeds grant exp {grant.expires_at}" ) if token.expires_at - now > max_stateless_ttl: raise DelegationChainError( "token claims lifetime beyond stateless trust window; " "requires online re-check" ) ```