# Which invariants prevent delegated-scope resurrection in AAIF credential chains when a mid-chain re-delegation outlives its parent warrant **Date of Record:** 2026 November 21 **Scope:** Applies to AAIF-style warrant chains (signed, attenuating capability tokens) where an agent re-delegates a subset of its scope to a sub-agent and the sub-agent's credential has an independent TTL or is cached/persisted beyond the parent's validity window. Does not apply to single-hop bearer tokens with no delegation, nor to chains that enforce strict epoch-bound revocation checks on every invocation. ## Core Distinction The distinction that matters is between **scope attenuation** (a child warrant's capability set is a subset of the parent's) and **scope liveness** (a child warrant is valid only while *every* ancestor in its chain is valid). Attenuation is usually enforced structurally at issuance: the issuer intersects the requested scope with its own and signs a narrower set. Liveness is *not* structural—it is a temporal predicate over the whole chain that must be re-evaluated at every use. AAIF chains routinely get attenuation right and liveness catastrophically wrong, because the child token is self-contained and signature-valid. A verifier that checks "signature valid + scope ⊆ my recorded scope + not expired" will accept a delegated credential whose grandparent was revoked or expired hours ago. The signature proves *who minted it*, not *that the minting authority still holds*. This is the delegation analogue of a dangling pointer: the child credential holds a reference (the parent's warrant ID / hash) to an authority object that has been freed, but nothing dereferences it at validation time. ## What Was Observed A planner agent `P` held an AAIF root warrant `W0` (scope: `repo:read`, `repo:write`, `tool:ci`, TTL 3600s). At t=200s it delegated `repo:read` + `tool:ci` to a build agent `B` as warrant `W1`, correctly attenuated, embedding `parent_id = hash(W0)` and `parent_expiry = t0+3600`. At t=400s `B` re-delegated `tool:ci` to a test-runner `R` as `W2`, embedding `parent_id = hash(W1)`. At t=900s an operator revoked `W0` (compromised planner) by pushing `hash(W0)` onto the revocation set. `P` and `B` both failed immediately at their next call—their verifiers dereferenced the revocation set. `R`, however, had cached `W2` in its local credential store at t=400s and, on a 15-minute refresh cadence, validated `W2` against a *local* policy that checked only: signature valid, `exp > now`, `scope ⊆ allowlist`. `W2`'s `exp` was t0+3600 (inherited, not shortened). `R` continued executing `tool:ci` for 41 minutes after the root was revoked, minting CI artifacts under a dead authority. The trace showed `R`'s verifier never dereferenced `parent_id`—it treated `parent_id` as provenance metadata, not as a liveness binding. The failure was not a crypto break. Every signature verified. The failure was that **`W2` is a resurrection of `W0`'s authority through two hops of indirection**, and the verifier's policy had no rule that a credential is only as alive as its least-alive ancestor. ## Condition of Validity The invariant that must hold for a delegated credential to be usable is: > `valid(W) ≡ sig_ok(W) ∧ now < W.exp ∧ scope(W) ⊆ scope(parent(W)) ∧ valid(parent(W)) ∧ hash(W) ∉ revoked` with the recursion terminating at a root warrant anchored to a trusted issuer. Note the two non-obvious conjuncts: `valid(parent(W))` makes liveness *transitive*, and `hash(W) ∉ revoked` must be checked at *every* node, not just the presented leaf. A verifier that collapses this to `sig_ok ∧ now < exp ∧ scope ⊆ allowlist` is unsound regardless of how well it attenuates. The condition of validity *fails*—and resurrection becomes possible—whenever any of the following hold: (a) the child's `exp` is not clamped to `min(ancestor expiries)` at issuance; (b) `parent_id` is carried but never dereferenced at validation; (c) revocation is checked only against the presented leaf's hash rather than walking the chain; or (d) the child credential is cached with a TTL longer than the chain's remaining liveness. Any one of these is sufficient. In the observed incident, (b), (c), and (d) all held simultaneously, which is why the resurrection window was 41 minutes rather than milliseconds. ## Decision Boundary The boundary an implementer must draw is between **stateless self-contained validation** (fast, cacheable, but unsound for delegation) and **chain-walking validation** (sound, but requires the verifier to reach the revocation set and every ancestor's status). The decision point is at credential *acceptance*, not at issuance: attenuation at issuance is necessary but not sufficient, and no amount of correct narrowing at mint time compensates for a verifier that skips the walk. Concretely: if a verifier cannot reach the revocation authority within its latency budget, it MUST fail closed for any credential whose `parent_id` is non-null, or it MUST require that the leaf's `exp` be clamped to a value no later than the shortest ancestor TTL *and* that the leaf carry a signed `chain_expiry` equal to `min` over the chain. The clamped-expiry approach is the only one that lets a verifier stay stateless and still be sound, because it collapses the transitive liveness predicate into a single local comparison—at the cost of forcing re-issuance whenever any ancestor's TTL is extended. You cannot have both stateless validation and unbounded delegation depth without either chain-walking or expiry-clamping; pick one and enforce it at the boundary. ## Operational Effect The operational consequence is that **revocation latency for a delegated credential is bounded by the depth of the chain times the re-validation cadence, not by the revocation push itself**. A root revocation that propagates in 50ms to direct holders can take `depth × cadence` to reach a leaf that caches. In the observed incident that was 2 hops × 15 min ≈ 30–45 min of post-revocation authority. The guardrail is twofold: (1) at issuance, clamp every child's `exp` and a signed `chain_expiry` to `min` over ancestors so a stateless verifier's local check is sound; (2) at validation, any credential with a non-null `parent_id` whose `chain_expiry` is absent or exceeds its own `exp` must be rejected as malformed, not merely warned. Teams that adopt only (1) still leak through cached credentials minted before the clamp was deployed; teams that adopt only (2) still leak through stateless verifiers that never see the field. Both are required, and the rejection in (2) must be a hard failure with a distinct error class so that resurrection attempts are observable in telemetry rather than silently downgraded to "expired." ```python import hashlib import time from dataclasses import dataclass from typing import Optional class DelegationResurrectionError(RuntimeError): """Raised when a delegated credential's authority outlives an ancestor warrant.""" @dataclass(frozen=True) class Warrant: warrant_id: str parent_id: Optional[str] scope: frozenset exp: float chain_expiry: Optional[float] # signed min() over all ancestor expiries signature_ok: bool = True def _hash(w: Warrant) -> str: return hashlib.sha256(w.warrant_id.encode()).hexdigest() def validate(w: Warrant, revoked: set, now: Optional[float] = None) -> None: now = time.time() if now is None else now if not w.signature_ok: raise DelegationResurrectionError(f"bad signature on {w.warrant_id}") if now >= w.exp: raise DelegationResurrectionError(f"{w.warrant_id} expired") # Leaf revocation check is necessary but not sufficient. if _hash(w) in revoked: raise DelegationResurrectionError(f"{w.warrant_id} revoked") if w.parent_id is None: return # root; issuer trust assumed established out of band # Invariant: a delegated warrant MUST carry a signed chain_expiry that # does not exceed its own exp. Absence => malformed, not "unknown". if w.chain_expiry is None: raise DelegationResurrectionError( f"{w.warrant_id} delegated but missing chain_expiry; " "stateless validation would be unsound" ) if w.chain_expiry > w.exp: raise DelegationResurrectionError( f"{w.warrant_id} chain_expiry {w.chain_expiry} exceeds exp {w.exp}" ) if now >= w.chain_expiry: # An ancestor has expired or been revoked; this leaf is a resurrection. raise DelegationResurrectionError( f"{w.warrant_id} resurrects dead ancestor authority " f"(chain_expiry={w.chain_expiry}, now={now})" ) # If the verifier can reach the revocation set, walk the chain too. if w.parent_id in revoked: raise DelegationResurrectionError( f"{w.warrant_id} parent {w.parent_id} revoked" ) def issue_child(parent: Warrant, child_id: str, scope: frozenset, ttl: float, now: Optional[float] = None) -> Warrant: now = time.time() if now is None else now parent_chain = parent.chain_expiry if parent.chain_expiry is not None else parent.exp # Clamp: child can never outlive the shortest ancestor. child_exp = min(now + ttl, parent_chain) if not scope <= parent.scope: raise DelegationResurrectionError( f"scope {scope} not subset of parent {parent.scope}" ) return Warrant( warrant_id=child_id, parent_id=_hash(parent), scope=scope, exp=child_exp, chain_expiry=child_exp, ) ```