# Which invariants prevent scope-narrowing replay in AAIF delegated credential chains when a sub-agent re-presents a parent warrant after token expiry **Date of Record:** 2026 November 26 **Scope:** Applies to AAIF delegated credential chains where a warrant W0 is attenuated into W1…Wn and presented at tool-call time as a scoped capability token. Does not cover root-issuer key compromise, nor single-hop bearer tokens without delegation depth. ## Core Distinction The failure is not "expired token accepted." It is that a *narrowed* descendant warrant (W2, scope ⊆ W1 ⊆ W0) is re-presented after its own `not_after` has lapsed but while the *parent* W1 is still valid, and the verifier—walking the chain to confirm attenuation monotonicity—mistakes the parent's liveness for the child's authority. Scope-narrowing chains carry two independent time bounds per hop, and the verifier must treat them as a conjunction over the *presented leaf*, not a disjunction inherited from the root. The boundary condition is the window `[W2.not_after, W1.not_after)` during which the leaf is dead but its ancestors are alive. ## What Was Observed A planner agent P holds W0 (scope: `fs:read:/data`, `tool:query`, `not_after=T+3600`). It delegates to a retrieval sub-agent R a warrant W1 (`fs:read:/data/reports`, `not_after=T+1800`). R further delegates to a summarizer S a warrant W2 (`fs:read:/data/reports/q3`, `not_after=T+600`). At `T+900`, S is resumed from a mid-task checkpoint (see cold-start amnesia) and re-presents W2 to the file tool. The tool's AAIF verifier walked the chain: W0 valid, W1 valid, W2 expired. Because the implementation validated "chain liveness" by checking that *some* ancestor remained live (a common optimization to avoid re-fetching revocation lists per hop), it accepted W2 and served `q3/summary.md`. The replay passed structural attenuation checks (scope ⊆ holds), signature chain intact, and the tool logged a legitimate authorized read. No alarm fired. The observable signature in the audit log: a single `warrant_verified` event with `leaf_not_after < now < root_not_after` and `attenuation_ok=true` — the three fields whose joint truth the verifier was never meant to accept. ## Condition of Validity The invariant that must hold at every verification: ``` valid(Wk, t) ⟺ sig_chain_ok(W0..Wk) ∧ ∀i∈[0,k]: scope(Wi) ⊆ scope(Wi-1) ∧ ∀i∈[0,k]: t < Wi.not_after # conjunction, not ∃ ∧ ∀i∈[0,k]: Wi ∉ revoked_set(t) ∧ depth(Wk) ≤ max_depth ``` The failure occurs precisely when the `∀` over `not_after` is weakened to `∃` — typically introduced as an optimization ("if the root is live, the delegation is live") that is sound for *bearer* tokens but unsound for *attenuating* chains, because attenuation is the mechanism by which a sub-agent's authority is supposed to be *strictly less* than its parent's, including in time. A narrower scope with a longer life would violate monotonicity; a narrower scope with a *shorter* life is the intended design, and expiry of the leaf is the enforcement point. ## Decision Boundary The verifier must reject when `now ≥ leaf.not_after` regardless of ancestor liveness. The boundary is sharp: there is no grace window, because the leaf's short `not_after` is often the *only* thing bounding a sub-agent's blast radius after its parent has moved on. Two corollaries: 1. **Re-delegation from a live parent does not resurrect a dead leaf.** If S needs to continue at `T+900`, the correct path is for R (still live until `T+1800`) to mint a *fresh* W2′ with a new nonce and new `not_after`. Re-presenting the old W2, even with a valid parent, is replay. 2. **Checkpoint resume must re-derive warrants, not replay them.** A resumed agent that holds a serialized W2 in its checkpoint state must treat it as a *claim to re-verify*, not a credential to present. The checkpoint's serialized warrant is stale state; the invariant is that the agent re-requests delegation on resume. ## Operational Effect Systems that weaken the per-hop time check to an ancestor check exhibit a characteristic exploit surface: any sub-agent whose checkpoint outlives its leaf warrant (common when checkpoint TTL > leaf TTL, which is the default in most agent runtimes) can, on resume, exercise authority its parent intended to have already withdrawn. The blast radius is bounded by the leaf's scope, so the damage is a *narrow* unauthorized read/write rather than a full-scope breach—which is exactly why it evades anomaly detection tuned for broad scope violations. The guardrail is to make the per-hop conjunction the *only* accepted verification path, to forbid serializing live warrants into checkpoint state (serialize the *delegation request*, not the credential), and to emit a distinct audit event `leaf_expired_parent_live` whenever the boundary is approached, so the window is observable before it is exploited. ```python from dataclasses import dataclass from typing import Sequence class WarrantReplayError(RuntimeError): """Raised when a leaf warrant is presented past its own not_after, even if an ancestor warrant in the chain remains live.""" @dataclass(frozen=True) class Warrant: scope: str # e.g. "fs:read:/data/reports/q3" not_after: int # epoch seconds parent_scope: str | None = None revoked: bool = False def _scope_narrows(child: str, parent: str) -> bool: return child == parent or child.startswith(parent.rstrip("/") + "/") def verify_chain(chain: Sequence[Warrant], now: int, max_depth: int = 4) -> None: if not chain: raise WarrantReplayError("empty warrant chain") if len(chain) > max_depth: raise WarrantReplayError(f"chain depth {len(chain)} exceeds max {max_depth}") # Structural attenuation: each hop must narrow its parent. for i in range(1, len(chain)): if not _scope_narrows(chain[i].scope, chain[i - 1].scope): raise WarrantReplayError( f"hop {i} scope {chain[i].scope!r} does not narrow {chain[i-1].scope!r}" ) # Per-hop time conjunction: the leaf's expiry is authoritative. leaf = chain[-1] if now >= leaf.not_after: # Diagnose the specific ancestor-live / leaf-dead window. live_ancestors = [w for w in chain[:-1] if now < w.not_after] if live_ancestors: raise WarrantReplayError( f"leaf expired at {leaf.not_after} (now={now}) while " f"{len(live_ancestors)} ancestor(s) still live; " f"replay of dead leaf under live parent is forbidden" ) raise WarrantReplayError(f"leaf expired at {leaf.not_after} (now={now})") for i, w in enumerate(chain): if w.revoked: raise WarrantReplayError(f"hop {i} revoked") if now >= w.not_after: raise WarrantReplayError(f"hop {i} expired at {w.not_after} (now={now})") def resume_from_checkpoint(serialized_leaf: Warrant, now: int, parent_live: Warrant) -> Warrant: """On resume, a serialized leaf is a claim to re-verify, not to present.""" if now >= serialized_leaf.not_after: # Correct behavior: re-derive a fresh leaf from the live parent. if now >= parent_live.not_after: raise WarrantReplayError("parent also expired; must re-delegate from root") return Warrant( scope=serialized_leaf.scope, not_after=min(now + 600, parent_live.not_after), parent_scope=parent_live.scope, ) verify_chain([parent_live, serialized_leaf], now) return serialized_leaf ```