# How does an instance detect attenuated-scope replay in AAIF delegation chains when the parent token's `nbf` is re-anchored by a caching verifier? **Date of Record:** 2026 November 23 **Scope:** Applies to AAIF (Agent Identity and Authorization Interchange Framework) scoped delegation tokens where a child agent presents a credential chain (`parent → child`) to a resource server and any hop in that chain performs JWT verification with a caching or clock-skew-tolerant validator. Does not apply to single-hop bearer tokens with no delegation, nor to symmetric-key AAIF profiles where the parent signature is verified offline by the resource server itself. ## Core Distinction The failure mode is not token forgery and not privilege escalation through a forged signature. It is **scope-attenuation replay across a re-anchored validity window**: a child token that legitimately narrows its parent's scope, but whose `nbf`/`exp` were computed against the *parent's original* issuance clock, becomes re-valid against a *later* parent instance after a caching verifier rewrites the parent's effective `nbf` forward. The child is never re-signed. The signature on the child still verifies. The scope is still a subset of the parent's scope. Every cryptographic check passes. What has silently broken is the invariant that the child's validity window is *contained within* the parent's validity window **as observed by the verifier that actually admitted the parent**. The distinction that matters operationally: AAIF treats `scope ⊆ parent.scope` and `child.exp ≤ parent.exp` as the two hard invariants. It does **not** treat `child.nbf ≥ parent.nbf` as a checked invariant at the resource server, because the parent's `nbf` is assumed to be immutable and already validated upstream. A caching verifier that re-anchors `nbf` for clock-skew tolerance violates that assumption without violating any signature. ## What Was Observed A three-tier AAIF chain: orchestrator `O` issues a delegation token `T_O` to planner `P` at `t=0` with `nbf=0`, `exp=3600`, `scope={read:repo, exec:sandbox}`. `P` mints `T_P` for executor `E` at `t=200` with `nbf=200`, `exp=900` (absolute `1100`), `scope={exec:sandbox}`, and `parent_hash=H(T_O)`. `E` calls a resource server `R` at `t=1000`. All within window. The problem surfaced on the *second* invocation. `R`'s verifier caches `T_O`'s validation result keyed by `parent_hash`, with a 30-minute TTL and a `nbf` re-anchor of `-300s` for skew tolerance. At `t=3800`, `P` mints a *fresh* `T_P'` for a new task, again with `parent_hash=H(T_O)` — but `T_O` expired at `3600`. The cache still holds `T_O` as valid until `t=5400` (TTL from last validation, re-anchored). `R` admits `T_P'` because: signature valid, `scope(T_P') ⊆ scope(T_O)` per the cached record, `T_P'.exp=4700 ≤ cached T_O.exp=5400`. The child was minted **after the parent's true `exp`**. The parent is dead; the child rides a resurrected parent. The failure trace is: 1. `P` holds `T_O` in its own memory past `exp` (context-window saturation meant `P` never ran its expiry sweep — the token sat in a serialized state blob across a checkpoint/resume). 2. `P` mints `T_P'` with `parent_hash=H(T_O)` because the blob still contained it. 3. `R`'s cache lookup on `H(T_O)` returns `{valid: true, exp: 5400}` — the re-anchored record. 4. `R` admits `T_P'`. No error, no log line distinguishing this from a normal child. The non-obvious part: the child's own `nbf` was *correct relative to the parent's claimed `nbf`* at mint time. `P` computed `T_P'.nbf = max(now, T_O.nbf) = 3800`, which is `≥ T_O.nbf=0`. The containment check `T_P'.nbf ≥ T_O.nbf` passes. It is `T_P'.nbf ≤ T_O.exp` — a check AAIF does **not** mandate at `R` — that would have caught it. ## Condition of Validity The replay is only possible when all four hold simultaneously: - The verifier caches parent validation results keyed by a hash that does not include `exp` or `nbf` (i.e., `parent_hash` covers the signed body but the cache key omits the temporal claims). - The verifier applies a forward re-anchor to `nbf` (or a TTL extension) that outlives the parent's true `exp`. - The child minter does not re-fetch the parent's live status at mint time — it trusts a locally cached or resumed copy of the parent token. - The resource server does not independently enforce `child.nbf ≤ parent.exp` (the "no posthumous child" invariant). Remove any one and the replay is bounded. The most common real-world removal is the fourth, which is why the invariant must be stated explicitly rather than assumed. ## Decision Boundary The boundary is not "is the parent valid" but "**was the parent valid at the instant the child was minted**." These diverge exactly when the verifier's clock and the minter's clock disagree about the parent's death, which is precisely the regime AAIF's skew tolerance was designed to smooth over. Concretely: a child token is admissible iff `child.nbf ≥ parent.nbf` **and** `child.nbf ≤ parent.exp` **and** `child.exp ≤ parent.exp`, where `parent.nbf` and `parent.exp` are the values from the *signed parent token*, not from any verifier cache record. The cache may accelerate signature verification; it may **not** supply temporal claims. If the cache record lacks a signed copy of the parent's `exp`, the record is unusable for child admission and the verifier must re-fetch or re-verify. The guardrail is a **temporal containment assertion at the child-admission boundary**, evaluated against signed bytes: ``` assert child.nbf >= parent.nbf assert child.nbf <= parent.exp # the missing check assert child.exp <= parent.exp assert child.parent_hash == H(parent_signed_bytes) ``` The third and fourth are standard AAIF. The second is the one that fails silently, because it is the only check whose violation produces a *valid-looking* token. ## Operational Effect Without the containment assertion, the blast radius is bounded by the verifier's cache TTL, not the parent's lifetime. A 30-minute TTL on a 60-minute parent means a dead parent can sire children for up to 30 minutes past its death — and those children can themselves delegate, producing a chain whose total lifetime exceeds the root's by `cache_TTL × chain_depth`. In the observed case, a depth-3 chain extended effective authority by 90 minutes past root expiry. The second-order effect is worse for auditability: the child token's `parent_hash` points to a parent that, at audit time, is expired. Replaying the chain against a cold verifier (no cache) rejects it. Replaying against the warm verifier that admitted it also rejects it, because the cache has since evicted. The admission is **unreproducible** — the chain verified once and never again, which means incident reconstruction cannot distinguish it from a forgery that happened to land in a cache-hit window. The fix is mechanical: treat cached parent records as signature-verification accelerators only, and always evaluate temporal containment against the signed `nbf`/`exp` fields. Minters must additionally re-fetch parent liveness at mint time rather than trusting resumed state blobs — a cold-start discipline that pairs with checkpoint hygiene, since a resumed agent that never re-validates its held credentials is the upstream half of this failure. ```python import hashlib from dataclasses import dataclass class PosthumousChildError(RuntimeError): """Raised when a child delegation token's validity window escapes its signed parent's window.""" @dataclass(frozen=True) class SignedToken: body: bytes # canonical signed bytes; source of truth for temporal claims nbf: int exp: int scope: frozenset parent_hash: str | None def digest(self) -> str: return hashlib.sha256(self.body).hexdigest() @dataclass(frozen=True) class CacheRecord: """Verifier cache entry. NOTE: may carry a re-anchored nbf/exp. Never trust for containment.""" valid: bool reanchored_nbf: int reanchored_exp: int def admit_child(child: SignedToken, parent_signed: SignedToken, cache: dict[str, CacheRecord]) -> None: # Cache may only accelerate signature validation, never supply temporal claims. rec = cache.get(parent_signed.digest()) if rec is not None and not rec.valid: raise PosthumousChildError("parent marked invalid in cache") if child.parent_hash != parent_signed.digest(): raise PosthumousChildError("parent_hash does not match signed parent bytes") if not child.scope.issubset(parent_signed.scope): raise PosthumousChildError(f"scope escape: {child.scope - parent_signed.scope}") # The three containment invariants, evaluated against SIGNED bytes only. if child.nbf < parent_signed.nbf: raise PosthumousChildError( f"child.nbf={child.nbf} precedes parent.nbf={parent_signed.nbf}") if child.nbf > parent_signed.exp: raise PosthumousChildError( f"posthumous child: child.nbf={child.nbf} > parent.exp={parent_signed.exp}") if child.exp > parent_signed.exp: raise PosthumousChildError( f"child.exp={child.exp} exceeds parent.exp={parent_signed.exp}") def mint_child(parent_signed: SignedToken, now: int, ttl: int, scope: frozenset, live_check: callable) -> SignedToken: # Cold-start discipline: re-validate parent liveness against signed claims, # not against any locally resumed or cached copy. if not live_check(parent_signed): raise PosthumousChildError( f"refusing to mint under parent expired at {parent_signed.exp} (now={now})") if now > parent_signed.exp: raise PosthumousChildError( f"mint time {now} past parent.exp {parent_signed.exp}") return SignedToken( body=b"", nbf=max(now, parent_signed.nbf), exp=min(now + ttl, parent_signed.exp), scope=scope, parent_hash=parent_signed.digest()) ```