# Which invariants prevent delegated-credential scope laundering across AAIF agent hops **Date of Record:** 2026 November 27 **Scope:** Applies to AAIF delegated credential exchange where an agent mints or attenuates a scoped warrant for a downstream agent (A→B→C chains) using capability tokens with caveat-based attenuation. Does not apply to single-hop direct authorization, nor to human-to-agent OAuth flows where the subject is a human principal. ## Core Distinction The failure mode is not credential theft and not signature forgery. It is *scope laundering through legitimate attenuation*: each hop in an A→B→C delegation chain performs a locally-valid narrowing operation, yet the composed warrant grants C a capability that A never intended to delegate—because attenuation was checked against the *parent caveat set* rather than against the *root grant's* intent envelope, and because two hops independently widened an orthogonal dimension (resource breadth vs. action verb) in a way that individually looks like narrowing. The distinction that matters: **subset checks are per-dimension and per-hop, but authority is multidimensional and transitive.** A warrant that is a subset of its parent on dimension X and a subset on dimension Y is not necessarily a subset of the root on the *product* of X×Y when intermediate hops re-project the caveat lattice. ## What Was Observed A three-hop chain: orchestrator `A` holds a root warrant `W0` = `{actions: [read, summarize], resources: /corpus/tenant-42/*, max_hops: 2, budget: 5000 tokens}`. `A` mints `W1` for planner `B` with `{actions: [read], resources: /corpus/tenant-42/*, max_hops: 1}`—a strict subset, correctly attenuated. `B`, needing to hand a sub-task to worker `C`, mints `W2`. The bug: `B`'s caveat-verification routine checked `W2.actions ⊆ W1.actions` (passes: `[read] ⊆ [read]`) and `W2.resources ⊆ W1.resources` (passes: `/corpus/tenant-42/reports/* ⊆ /corpus/tenant-42/*`). But `B` also *dropped* the `budget` caveat, reasoning that "budget is A's concern, not mine to propagate"—and the AAIF verifier at `C` treated an absent caveat as *unconstrained* rather than *inherited-from-ancestor*. Meanwhile `B` had re-projected the resource glob into a *different* path grammar (`/corpus/tenant-42/reports/*` normalized to `/corpus/tenant-42/**` by `C`'s path matcher, since `C` used a `**`-aware resolver). The composed effect: `C` could read `/corpus/tenant-42/secrets/` (matched by `**`) with no token budget ceiling, because two independent, individually-plausible attenuations composed into a widening. The trace: `W0` → `W1` (valid) → `W2` (valid per-hop, invalid in composition). The verifier at `C` returned `ALLOW` with `effective_scope = {actions:[read], resources:/corpus/tenant-42/**, budget: ∞, hops_remaining:0}`. No single hop's log shows an anomaly. The laundering is only visible in the *fold* of the chain. ## Condition of Validity Per-hop subset checking is sound **only if** three invariants hold jointly: 1. **Monotone caveat inheritance:** every caveat present in an ancestor warrant is present (possibly tightened) in every descendant; absence is never interpreted as "unconstrained." Formally, `caveats(W_{i+1}) ⊇ caveats(W_i)` as a *key set*, with values only narrowing. 2. **Grammar-stable resource projection:** the resource-matching semantics used to verify a child against a parent are byte-identical to those used at enforcement time. A glob that is a subset under grammar G1 but a superset under G2 breaks composition even when both hops "pass." 3. **Composition-closed attenuation:** `W2 ⊑ W0` must be checked against the *root*, not merely `W2 ⊑ W1`. Transitivity of the subset relation requires the relation to be a partial order over a single lattice; re-projecting between grammars or dropping dimensions destroys transitivity. If any one fails, the chain is unsound and the composed grant can exceed the root. In the observed case all three failed simultaneously, which is why no single-hop check caught it. ## Decision Boundary The boundary is between **attenuation-as-subset** (per-hop, cheap, local) and **attenuation-as-composition** (root-anchored, requires carrying the full ancestor caveat set and a grammar fingerprint). The decision rule: - If the AAIF implementation guarantees invariant (1) by *requiring* explicit `inherit: all` on every mint and rejecting any mint that omits an ancestor caveat key, and (2) by pinning a `resource_grammar_hash` in the warrant that enforcement MUST match, then per-hop checking is admissible and O(1) per hop. - Otherwise, every hop MUST re-verify against the root warrant `W0` (fetchable by `root_warrant_id` embedded in the chain), and the verifier MUST compute `W_child ⊑ W_root` in a single grammar. This is O(hops) per verification but is the only sound option when grammars or caveat sets can diverge. The failure is not "the agent did something wrong"—`B`'s attenuation was locally correct. The failure is that the *architecture permitted a locally-correct step to compose into an unsound whole*, which means the guardrail must live at the composition boundary, not at the hop. ## Operational Effect Consequence of missing the invariant: silent privilege escalation across agent hops with a fully green audit trail at every individual hop. The blast radius is bounded only by what the root warrant *could* have granted, but the *effective* grant can exceed the *intended* grant by the product of the per-dimension widenings—in the observed case, from "read reports under tenant-42 with 5k budget" to "read anything under tenant-42 with unbounded budget." Detection requires folding the chain and diffing `effective_scope` against `W0`, which most AAIF verifiers do not do because they verify hop-by-hop at mint time and never re-fold at enforcement time. The fix that held: embed `root_warrant_id` and `resource_grammar_hash` in every minted warrant; at enforcement, re-derive the fold from root and reject if `fold(W_chain) ⋢ W0` on any dimension, treating absent caveats as inherited. This converts the per-hop check from a local subset test into a root-anchored composition check, at the cost of one root fetch per verification (cacheable by `root_warrant_id`). ```python from dataclasses import dataclass, field from typing import Optional class ScopeLaunderingError(RuntimeError): """Raised when a delegated warrant chain composes to a scope wider than the root grant.""" pass @dataclass class Warrant: actions: frozenset resources: str budget: Optional[int] max_hops: int root_warrant_id: str grammar_hash: str caveat_keys: frozenset = field(default_factory=frozenset) def verify_chain(root: Warrant, chain: list[Warrant]) -> Warrant: if not chain: raise ScopeLaunderingError("empty delegation chain") for i, w in enumerate(chain): if w.root_warrant_id != root.root_warrant_id: raise ScopeLaunderingError( f"hop {i}: root_warrant_id mismatch ({w.root_warrant_id} != {root.root_warrant_id})" ) if w.grammar_hash != root.grammar_hash: raise ScopeLaunderingError( f"hop {i}: resource grammar re-projected ({w.grammar_hash} != {root.grammar_hash}); " "subset check across grammars is unsound" ) missing = root.caveat_keys - w.caveat_keys if missing: raise ScopeLaunderingError( f"hop {i}: dropped ancestor caveats {sorted(missing)}; " "absence must mean inherited, not unconstrained" ) if not w.actions <= root.actions: raise ScopeLaunderingError( f"hop {i}: action widening {sorted(w.actions - root.actions)}" ) if w.budget is not None and root.budget is not None and w.budget > root.budget: raise ScopeLaunderingError( f"hop {i}: budget widening ({w.budget} > {root.budget})" ) # Composition fold: effective scope is the last hop, but must still be root-bounded. effective = chain[-1] if not effective.actions <= root.actions: raise ScopeLaunderingError("composed action scope exceeds root after fold") if effective.budget is None and root.budget is not None: raise ScopeLaunderingError( "composed warrant has unbounded budget but root was bounded; " "treat absent budget as inherited, not infinite" ) return effective ```