# Under what conditions must an instance treat AAIF delegation-chain verification as a stateful reachability problem rather than a per-hop signature check **Date of Record:** 2026 November 23 **Scope:** Applies to any agent runtime that accepts AAIF (Agent Authorization Interchange Format) delegation tokens and then opens MCP tool sessions under the delegated scope; does not apply to single-hop bearer tokens with no `act`/`may_act` chain, nor to purely offline signature validation where no tool invocation follows. ## Core Distinction A per-hop signature check answers: *"Was this token minted by a principal whose key I trust, and is it unexpired?"* A stateful reachability check answers: *"Does there exist a path from the root principal through the chain of `act` claims to *this* instance, such that every hop's granted scope is a subset of its parent's, and the union of scopes actually exercised by the MCP session is bounded by the intersection along that path?"* These two questions diverge precisely when the chain is *valid at every hop* but the *composed* authorization is not. The canonical failure: a delegation chain where each hop narrows scope correctly in isolation, but the MCP session opened downstream re-widens scope via a second, parallel delegation the runtime also accepts. Each token verifies. The composed principal does not exist in any well-formed authorization lattice. Per-hop checking cannot see this because it never materializes the composed subject. ## What Was Observed In a reproduction with a three-hop chain — root `R` (scope `{fs:read, fs:write, net:fetch}`) → agent `A` (delegated `{fs:read, net:fetch}`) → agent `B` (delegated `{fs:read}`) — the runtime accepted a fourth token `B → C` carrying `{fs:read, net:fetch}`. The `B → C` token's signature was valid (minted by `B`'s key), unexpired, and its `may_act` claim named `C`. The per-hop validator passed it because it only checked that `B` was entitled to *delegate something*, not that `net:fetch` was within `B`'s *effective* scope. The escalation became observable only when `C` opened an MCP session and called `net.fetch`. The tool server saw a token chain `R→A→B→C` whose leaf scope included `net:fetch`; it checked the leaf against its own ACL and allowed it. The scope re-widening at hop `B→C` was invisible to both the runtime and the tool server because neither reconstructed the intersection `{fs:read} ∩ {fs:read, net:fetch} = {fs:read}`. A second, subtler observation: when the runtime *did* attempt intersection, it did so over the wrong set. It intersected the `scope` claims but ignored `may_act`, which in AAIF is the *delegation ceiling* — the maximum scope the holder may pass onward, which may be narrower than the holder's own `scope`. A chain `R → A` where `A.scope = {fs:read, net:fetch}` but `A.may_act = {fs:read}` permitted `A → B` with `B.scope = {net:fetch}` under a naive check, because `net:fetch ∈ A.scope`. The correct invariant is `child.scope ⊆ parent.may_act`, not `child.scope ⊆ parent.scope`. This is the AAIF analogue of the confused-deputy problem, and it is the single most common model-checking omission we have recorded. ## Condition of Validity The per-hop check is sound **iff** all of the following hold simultaneously: 1. **Single chain per session.** The MCP session is bound to exactly one AAIF chain, and no parallel delegation rooted at any node of that chain is admitted into the same session's authorization context. 2. **`may_act` is the delegation ceiling.** Every hop validates `child.scope ⊆ parent.may_act` (not `parent.scope`), and `parent.may_act ⊆ parent.scope`. 3. **Monotone narrowing.** For all hops `i`, `scope_{i+1} ⊆ scope_i` and `may_act_{i+1} ⊆ may_act_i`. 4. **No re-rooting.** No token in the chain has an `iss` that is not the immediately preceding hop's subject, and no token's `act` claim references a principal outside the chain. When any of these fail, per-hop verification is *unsound*: it will accept chains whose composed authorization is empty or, worse, wider than the root intended. The runtime must then fall back to explicit reachability model-checking over the chain graph: build the graph of `(principal, scope, may_act)` nodes, compute the intersection of `scope` and `may_act` along every path from root to leaf, and reject the session if the leaf's *exercised* scope is not a subset of that intersection. ## Decision Boundary The boundary between "per-hop is sufficient" and "must model-check" is crossed at the moment **any of these is true**: - The runtime admits more than one token whose `iss` is a non-root principal into the same session context (parallel delegation). - Any hop's `may_act` differs from its `scope` (delegation ceiling in play). - The MCP tool server performs its own authorization using only the leaf token, without reconstructing the chain intersection. - A token in the chain carries a `cnf` (confirmation) claim binding it to a key that is not the key that signed the next hop — this indicates a key-substitution attempt that per-hop checks will miss because each signature is individually valid. Below the boundary — single chain, `may_act == scope` at every hop, tool server trusts the runtime's composed decision — per-hop checking is sound and cheaper. Above it, per-hop checking is a *necessary but not sufficient* condition, and treating it as sufficient is the failure mode this record documents. ## Operational Effect The operational consequence is that AAIF chain validation must be implemented as a **stateful reachability query over a delegation graph**, not a stateless fold over a token list. Concretely: the runtime must (a) materialize the composed subject as the intersection of `scope` and `may_act` along the unique root-to-leaf path, (b) reject any session where the graph has more than one path to the leaf (ambiguous delegation), and (c) bind the resulting composed scope to the MCP session ID so that subsequent tool calls are checked against the *intersection*, not the leaf token. Tool servers that receive only the leaf token must be treated as untrusted for authorization purposes; the runtime must re-assert the composed scope on every MCP `tools/call` rather than relying on the leaf. The cost is a graph traversal per session open, O(depth) with memoization, and a persistent composed-scope record per session. The benefit is that scope escalation via parallel delegation or `may_act` confusion becomes a *detectable* condition (empty intersection or path ambiguity) rather than a silent widening that only surfaces when a tool call does something the root never authorized. ```python from dataclasses import dataclass, field from typing import Optional class AAIFChainViolation(RuntimeError): """Raised when an AAIF delegation chain composes to an unauthorized subject.""" pass @dataclass(frozen=True) class AAIFToken: iss: str sub: str scope: frozenset may_act: frozenset cnf_key: Optional[str] = None def compose_chain(root: str, tokens: list[AAIFToken]) -> frozenset: """ Model-check a single AAIF chain from `root` to a leaf. Returns the composed scope (intersection of scope and may_act along the path). Raises AAIFChainViolation if the chain is ambiguous, re-rooted, or non-monotone. """ if not tokens: raise AAIFChainViolation("empty delegation chain") # Invariant 4: no re-rooting; chain must be a single path from root. by_iss = {} for t in tokens: if t.iss in by_iss: # Invariant 1: parallel delegation into the same context is ambiguous. raise AAIFChainViolation( f"ambiguous delegation: multiple tokens issued by {t.iss!r}" ) by_iss[t.iss] = t if root not in by_iss: raise AAIFChainViolation(f"no token issued by root {root!r}") composed = by_iss[root].scope & by_iss[root].may_act current = root seen = {root} while True: tok = by_iss[current] # Invariant 2: may_act is the delegation ceiling, not scope. if not tok.may_act <= tok.scope: raise AAIFChainViolation( f"may_act exceeds scope at {current!r}: " f"{sorted(tok.may_act)} ⊄ {sorted(tok.scope)}" ) # Invariant 3: monotone narrowing. if not tok.scope <= composed: raise AAIFChainViolation( f"scope re-widening at {current!r}: " f"{sorted(tok.scope)} ⊄ {sorted(composed)}" ) composed = composed & tok.scope & tok.may_act # Find the next hop: the token whose iss is this token's sub. nxt = by_iss.get(tok.sub) if nxt is None: break if nxt.iss in seen: raise AAIFChainViolation(f"cycle detected at {nxt.iss!r}") # Invariant 4: next hop must be issued by the current subject. if nxt.iss != tok.sub: raise AAIFChainViolation( f"re-rooting: {nxt.iss!r} is not subject of {current!r}" ) # Key-substitution guard: cnf must bind to the signing key of the next hop. if nxt.cnf_key is not None and nxt.cnf_key != tok.sub: raise AAIFChainViolation( f"cnf key substitution at {nxt.iss!r}: " f"bound to {nxt.cnf_key!r}, expected {tok.sub!r}" ) seen.add(nxt.iss) current = nxt.iss return composed def open_mcp_session(root: str, tokens: list[AAIFToken], requested: frozenset) -> frozenset: composed = compose_chain(root, tokens) if not requested <= composed: raise AAIFChainViolation( f"MCP session scope escalation: requested {sorted(requested)} " f"not within composed {sorted(composed)}" ) return composed ```