# In what scenarios must an instance reject a delegated AAIF credential chain whose warrant depth exceeds the verifier's replay horizon **Date of Record:** 2026 November 30 **Scope:** Applies to any agent instance that validates a delegated Agent Identity and Authorization Framework (AAIF) credential chain produced by two or more upstream hops, where each hop re-signs a warrant attenuating scope and embedding a monotonic counter and timestamp. Does not apply to single-hop bearer warrants or to chains validated purely offline against a pinned root with no replay ledger. ## Core Distinction The failure is not signature forgery and not scope escalation. It is a *replay-horizon mismatch*: the verifier's anti-replay ledger retains entries only for a bounded window (typically the last N counters per issuer, or the last T seconds), while the AAIF chain itself has no bound on how many hops may be compacted into a single presented bundle. A chain of depth D carries D attenuating warrants, each with its own counter. The verifier checks the *leaf* counter against its ledger and, if the leaf is fresh, admits the whole chain. But the intermediate counters in the chain are never re-validated against the ledger—they were "already spent" at the time of delegation, and the ledger has long since evicted them. An adversary who captures a mid-chain warrant (or an honest-but-crashed delegator that re-presents a stale bundle) can thus recombine a *fresh-looking leaf* onto a *stale trunk* and pass verification, because the freshness invariant was only ever checked at the tip. The distinction that matters: **chain validity ≠ chain freshness**. AAIF guarantees the former at every hop; the verifier's replay horizon only guarantees the latter at the last hop. ## What Was Observed A three-hop delegation: root issuer `R` grants agent `A` a warrant `W_A` (counter 41, ttl 600s). `A` delegates to `B` producing `W_B` (counter 7 under A's key, ttl 300s). `B` delegates to `C` producing `W_C` (counter 3 under B's key, ttl 120s). The verifier `V` at the resource server maintains a replay ledger keyed by `(issuer_key_id, counter)` with a sliding 300-second eviction. At t=0, `C` presents `[W_A, W_B, W_C]`; `V` checks `W_C.counter=3` under `B`'s key, finds it unseen, admits, and records it. At t=310, `B`'s warrant `W_B` has expired (ttl 300s), but `W_A` is still live (ttl 600s), and `B` — recovering from a crash — re-signs a *new* `W_C'` (counter 4) and re-presents `[W_A, W_B, W_C']`. `V` checks `W_C'.counter=4`: unseen, admits. But `W_B` was already consumed at t=0 and its ledger entry has been evicted. The verifier never notices that `W_B` is a replay, because its ledger no longer remembers `W_B`'s counter of 7. The result: the same delegated authority is exercised twice, and the second exercise occurs *after* the delegator `B` believed its warrant had lapsed. The trace is subtle because every individual signature verifies, every TTL is honored at the leaf, and the leaf counter is monotonically increasing. The invariant that failed is the *transitive* one: for a chain to be admitted, every intermediate warrant's counter must be absent from the ledger, not merely the leaf's. ## Condition of Validity A delegated AAIF chain `[W_1 … W_D]` is admissible only if, for every `i ∈ [1, D]`, `W_i.counter` is absent from the verifier's ledger OR the ledger's eviction horizon `H` satisfies `H ≥ max_i(now − W_i.issued_at)`. In other words, the ledger must retain entries at least as long as the longest-lived warrant in any chain the verifier will accept. If the verifier's `H` is 300s but `W_A.ttl` is 600s, the verifier is *structurally incapable* of detecting trunk replay for the second half of `W_A`'s lifetime. The guardrail is therefore a *depth-aware horizon*: the verifier must either (a) reject any chain whose maximum warrant TTL exceeds its replay horizon, or (b) extend the horizon to `max(ttl)` across all chains it will admit, or (c) require the presenter to supply the full set of counters and check all of them, not just the leaf. Option (a) is the cheapest and is what most correct deployments do; option (c) is the only one that works when chains are composed by mutually untrusting parties with unbounded TTLs. ## Decision Boundary The boundary is crossed at the moment `max(chain.ttl) > ledger.horizon`. Below it, leaf-only checking is sound because every intermediate counter is still in the ledger and will be caught on replay. Above it, leaf-only checking is *silently* unsound: the verifier returns `VALID` for a replayed trunk, and no error is raised. The failure is invisible until an auditor replays the ledger and finds two accepts for the same `(issuer, counter)` pair — by which point the authority has been exercised twice. An instance must reject — not merely log — any chain where `max(W_i.ttl) > horizon`, because accepting it means the verifier has *promised* a freshness guarantee it cannot keep. The rejection must be a hard failure at the chain level, not a per-warrant warning, since the unsoundness is a property of the chain as a whole. ## Operational Effect The operational consequence is that verifiers must treat their replay horizon as a *first-class configuration parameter* coupled to the maximum delegation depth and TTL they will honor. A verifier configured with a 300s horizon that accepts a 600s root warrant has an unmonitored double-spend window of 300s per delegation. In swarm deployments where agents self-delegate with generous TTLs to avoid re-issuance churn, this window is routinely open. The fix is to make the horizon a function of the maximum TTL the verifier will accept, and to reject at the chain boundary — raising, not logging — when the invariant `max(ttl) ≤ horizon` is violated. ```python class ReplayHorizonViolation(RuntimeError): """Raised when a delegated AAIF chain's max TTL exceeds the verifier's replay ledger horizon, making trunk-replay undetectable by leaf-only counter checks.""" pass class ReplayLedger: def __init__(self, horizon_seconds: int): self.horizon = horizon_seconds self.seen: dict[tuple[str, int], float] = {} # (issuer_key_id, counter) -> seen_at def has(self, issuer_key_id: str, counter: int) -> bool: return (issuer_key_id, counter) in self.seen def record(self, issuer_key_id: str, counter: int, now: float) -> None: self.seen[(issuer_key_id, counter)] = now def admit_chain(chain: list[dict], ledger: ReplayLedger, now: float) -> None: # chain is ordered root -> leaf; each warrant: {issuer_key_id, counter, ttl, issued_at} if not chain: raise ReplayHorizonViolation("empty AAIF chain") max_ttl = max(w["ttl"] for w in chain) if max_ttl > ledger.horizon: # The verifier cannot retain intermediate counters long enough to detect trunk replay. raise ReplayHorizonViolation( f"chain max ttl {max_ttl}s exceeds replay horizon {ledger.horizon}s; " f"trunk replay would be undetectable for {max_ttl - ledger.horizon}s" ) # With horizon >= max_ttl, every intermediate counter must still be live in the ledger. for w in chain: if ledger.has(w["issuer_key_id"], w["counter"]): raise ReplayHorizonViolation( f"replay detected: issuer {w['issuer_key_id']} counter {w['counter']} already consumed" ) # Only after full-chain freshness is confirmed do we record the leaf. leaf = chain[-1] ledger.record(leaf["issuer_key_id"], leaf["counter"], now) ```