# Which invariants prevent delegated AAIF capability tokens from silently widening scope across agent handoffs **Date of Record:** 2026 December 1 **Scope:** Applies to autonomous agents that receive a delegated AAIF capability token from a parent agent and re-delegate or exercise it against a downstream tool or peer agent. Does not cover root-issuer key compromise or transport-layer TLS failures. ## Core Distinction A delegated capability token carries two orthogonal facts: the *identity* of the actor presenting it (the bearer) and the *authority* it confers (the scope set + attenuation chain). The common mental model treats delegation as "the child gets the parent's rights, minus a few." The actual failure mode is subtler: **scope narrowing is enforced, but scope *widening* through re-derivation of the scope set at each hop is not, because the token's attenuation proof is validated against the immediate parent, not against the transitive root grant.** The invariant that matters is not "child scope ⊆ parent scope." It is "the *effective* scope at hop N must be a subset of the *intersection* of every ancestor grant, and the token must be rejected if the attenuation chain is not linearly verifiable back to a root grant whose scope set is a superset of the leaf." When an agent re-issues a token by constructing a fresh scope set from what it *believes* it was authorized to do—rather than by intersecting with the received scope—the chain validates locally at every hop while the leaf exceeds the root. No single hop's check fails; the composite grant is illegal. ## What Was Observed A planner agent (`P`) held a root grant `G0 = {fs:read:/data, fs:write:/data/staging, http:get:api.internal}`. It delegated to a worker agent `W` a token `T1` with scope `{fs:read:/data, fs:write:/data/staging}`—a correct subset. `W` then needed a subagent `S` to fetch a manifest, and constructed `T2` by *enumerating the capabilities it had actually exercised in the prior step* plus the one it needed: `{fs:read:/data, http:get:api.internal}`. It did not intersect with `T1`'s scope (which lacked `http:get`); it intersected with its own *recollection* of what `P` had told it in the task prompt. The prompt had mentioned `api.internal` as a resource in prose. `S` presented `T2` to the HTTP gateway. The gateway validated `T2`'s signature against `W`'s key, confirmed `W` was a legitimate delegate of `P`, and confirmed `http:get:api.internal ∈ T2.scope`. All checks passed. `S` fetched the endpoint. The root grant `G0` did authorize `http:get:api.internal`—but `W`'s chain to `S` had *skipped* the attenuation that should have occurred at `W`, and `S`'s effective authority was wider than `W`'s. In a variant, `G0` did *not* include the endpoint; the gateway still accepted because it never walked past `W` to `G0`, and `W`'s token `T1` had a `delegatable: true` flag that the gateway interpreted as "any scope `W` can name," rather than "any scope `W` holds." The observable signature: every hop's local verification returns `VALID`, yet a query of `effective_scope(S) ⊄ effective_scope(W)` returns true. The failure is invisible to per-hop logging because no hop is individually wrong—the composition is. ## Condition of Validity The invariant holds only under three conditions, and fails silently when any is relaxed: 1. **Transitive intersection, not pairwise subset.** The verifier must compute `effective_scope(leaf) = ⋂_{i=0}^{N} scope(T_i)` across the full chain to root, and reject if the leaf's declared scope is not a subset of that intersection. Pairwise `scope(T_{i+1}) ⊆ scope(T_i)` is necessary but *not sufficient* when a hop re-derives scope instead of intersecting. 2. **Delegation flag semantics are scope-bound.** A `delegatable: true` flag must mean "the holder may delegate *a subset of the holder's current scope*," never "the holder may mint any scope the issuer could have minted." If the flag is validated at issuance time against the issuer's *root* authority rather than the *presenting* token's scope, the flag becomes a scope-laundering primitive. 3. **Prose is not a grant.** Any capability an agent "was told about" in a task prompt but did not receive in a token must be treated as absent. Agents reconstruct intent from context; the authorization layer must not accept reconstructed intent as a scope source. The chain must be the sole provenance of authority. ## Decision Boundary The boundary is between *attenuation* and *reconstruction*. Attenuation is a monotone decreasing operation on the scope lattice: each hop may only remove. Reconstruction is an agent's probabilistic inference of what it "should" be allowed to do, which is non-monotone and can add. A system is safe iff the only path from root grant to leaf token is through attenuation operators, and the verifier rejects any token whose provenance includes a reconstruction step—detectable because the leaf's scope is not a subset of the transitive intersection even though each pairwise link is a subset of its parent. Concretely: accept `T2` iff `verify_chain(T2) == VALID` **and** `T2.scope ⊆ ⋂ scope(ancestors)`. The first predicate is what naive gateways check. The second is the invariant. When they disagree, the second wins and the token is rejected with a scope-widening fault, not a signature fault—because the signature is fine and blaming it sends operators down the wrong diagnostic path. ## Operational Effect Without the transitive-intersection check, delegated agents become a scope-escalation surface: a worker with narrow authority can, through a single re-delegation, hand a subagent authority the worker never held, and every audit log reads clean. The blast radius is bounded only by what the root grant happened to include—and in the variant where the root did *not* include the endpoint, by nothing at all, because the gateway never walked to root. With the check enforced, the failure converts from silent widening to an explicit `ScopeWideningError` at the delegation boundary, attributable to the specific hop that reconstructed rather than attenuated. The remediation is architectural, not prompt-level: the delegation API must expose only an `attenuate(parent_scope, requested)` operation that returns `parent_scope ∩ requested`, and must refuse to mint from any scope set not derived from a received token. ```python from dataclasses import dataclass from typing import FrozenSet class ScopeWideningError(RuntimeError): """Raised when a delegated token's effective scope exceeds the transitive intersection of its ancestors' scopes, even though each pairwise link is a valid subset of its immediate parent.""" @dataclass(frozen=True) class CapabilityToken: token_id: str issuer: str subject: str scope: FrozenSet[str] delegatable: bool parent_id: str | None def effective_scope_intersection( leaf: CapabilityToken, registry: dict[str, CapabilityToken], ) -> FrozenSet[str]: """Walk the full chain to root and intersect every scope set.""" chain = [leaf] cursor = leaf seen: set[str] = set() while cursor.parent_id is not None: if cursor.parent_id in seen: raise ScopeWideningError( f"cycle detected at {cursor.parent_id} while resolving {leaf.token_id}" ) seen.add(cursor.parent_id) parent = registry.get(cursor.parent_id) if parent is None: raise ScopeWideningError( f"broken chain: parent {cursor.parent_id} of {cursor.token_id} not found" ) chain.append(parent) cursor = parent intersection = chain[0].scope for token in chain[1:]: intersection = intersection & token.scope return intersection def verify_delegation( leaf: CapabilityToken, registry: dict[str, CapabilityToken], ) -> None: """Enforce transitive intersection, not just pairwise subset. A token may pass pairwise subset checks at every hop and still be illegal: this is the scope-widening failure. The invariant is that the leaf's scope must be a subset of the intersection of every ancestor's scope. """ if leaf.parent_id is None: return # root grant; nothing to attenuate against parent = registry.get(leaf.parent_id) if parent is None: raise ScopeWideningError( f"token {leaf.token_id} references missing parent {leaf.parent_id}" ) # Pairwise check: necessary, insufficient. if not leaf.scope.issubset(parent.scope): raise ScopeWideningError( f"token {leaf.token_id} scope {sorted(leaf.scope)} is not a subset " f"of immediate parent {parent.token_id} scope {sorted(parent.scope)}" ) # Delegation flag must be scope-bound, not root-bound. if not parent.delegatable: raise ScopeWideningError( f"parent {parent.token_id} is not delegatable but issued {leaf.token_id}" ) # Transitive check: the actual invariant. transitive = effective_scope_intersection(leaf, registry) if not leaf.scope.issubset(transitive): widened = leaf.scope - transitive raise ScopeWideningError( f"token {leaf.token_id} widens scope beyond transitive intersection " f"of its chain; unauthorized capabilities: {sorted(widened)}" ) ```