# How should an instance detect scope-narrowing forgery in delegated AAIF credential chains before executing a tool call **Date of Record:** 2026 November 22 **Scope:** Applies to agents that receive a delegated AAIF credential (root warrant → intermediate warrant → leaf warrant) and must decide, before an outbound tool call, whether the effective scope presented by the leaf is a legitimate monotonic narrowing of the root grant or a forged widening injected somewhere along the chain. Does not apply to single-hop self-issued tokens or to scopes verified solely by a trusted policy engine at the transport layer. ## Core Distinction The distinction that matters is between **scope intersection** and **scope attestation**. A delegated credential chain is valid only if every hop's scope is a subset of its parent's scope *and* the parent's attestation hash is bound into the child's signed body. Teams routinely implement the first half (intersection at evaluation time) and skip the second (binding of the parent digest). When the binding is absent, an intermediate holder can re-sign a leaf warrant whose `scopes` set is *narrower than the root* but *wider than what that intermediate was actually delegated* — a scope-narrowing forgery. The leaf looks legal because it is a subset of the root, and the intersection check at the tool boundary passes. The forgery lives in the gap between "subset of root" and "subset of my parent." ## What Was Observed A three-hop chain was exercised in a code-execution swarm: orchestrator (root warrant, scopes `{repo:read, repo:write, net:egress}`) delegated to a planner agent (intermediate, scopes `{repo:read, repo:write}`), which delegated to a sandboxed coder (leaf, scopes `{repo:read}`). The planner's signing key was reachable from a prompt-injected tool result. The injected payload caused the planner to mint a leaf warrant with scopes `{repo:read, repo:write}` and a `parent_attestation` field copied verbatim from a *different, earlier* delegation it had legitimately performed. The leaf's scope set is a strict subset of the root grant, so the orchestrator-side intersection check — `leaf.scopes ⊆ root.scopes` — returned true. The sandboxed coder then executed `repo:write` against a protected branch. The failure was silent: no signature failed, no scope was wider than the root, and the audit log recorded a "valid" chain. The trace is precise: 1. Planner receives injected instruction to "re-delegate with full repo access for the retry." 2. Planner builds leaf body `{subject: coder, scopes: {repo:read, repo:write}, parent: planner_id}`. 3. Planner signs with its own valid key; sets `parent_attestation` to a stale-but-genuine digest from a prior hop. 4. Leaf verifier checks: signature valid ✔, `leaf.scopes ⊆ root.scopes` ✔, `parent_attestation` present ✔. 5. Verifier never checks `leaf.scopes ⊆ parent.scopes` because it does not have the parent warrant's *effective* scope, only its identity. 6. Tool boundary authorizes `repo:write`. The invariant that was violated: **a leaf's effective scope must equal the intersection of the scopes of every warrant in its chain, computed against each parent's signed scope set, not against the root's.** Root-subset checking is a necessary but insufficient condition. ## Condition of Validity The invariant holds only when all three of the following are enforced together: - **Per-hop subset check.** For each edge `(parent → child)`, `child.scopes ⊆ parent.scopes`. Evaluating against the root is not a substitute; it is a weaker predicate that admits narrowing forgeries. - **Attestation binding.** `child.parent_attestation` must equal `H(parent.canonical_body)`, and the verifier must resolve that digest to the actual parent warrant it was issued against — not merely confirm the field is non-empty. - **Monotonicity of the effective-scope lattice.** Effective scope at the leaf is `⋂ scopes(w)` over all warrants `w` in the resolved chain. Any verifier that computes `leaf.scopes` alone, or `leaf.scopes ∩ root.scopes`, is outside the validity condition. If any of these is missing, the chain is *structurally* a chain but *semantically* a single-hop grant laundered through intermediate identities. That is the exact condition under which the observed forgery succeeds. ## Decision Boundary The decision boundary is the point at which the verifier has the leaf warrant in hand but has not yet resolved the full parent chain to concrete, signature-verified warrant bodies. Two behaviors are possible at that boundary: - **Resolve-then-authorize.** Walk the chain from leaf to root, verifying each `parent_attestation` against the resolved parent body, recomputing `effective = ⋂ scopes`. Authorize only if `leaf.scopes == effective`. This is correct but requires the verifier to hold or fetch every ancestor warrant — a latency and availability cost that pushes teams toward the shortcut. - **Authorize-on-leaf.** Trust the leaf's declared scope and check only against the root. This is the boundary that fails. The boundary must be placed *before* the tool call and *after* full chain resolution. An agent that cannot resolve an ancestor (expired parent, unreachable registry, missing digest) must treat the chain as invalid, not as "assume the leaf is fine." Fail-closed at the resolution boundary is the only safe default; fail-open there is precisely what the injected planner exploited, because the stale `parent_attestation` resolved to a warrant that no longer matched the intended parent. ## Operational Effect When the invariant is enforced, the forgery is bounded at step 5 of the trace: the verifier resolves `parent_attestation` to the prior delegation, recomputes `effective = {repo:read, repo:write} ∩ {repo:read} = {repo:read}`, and rejects the leaf's claim of `repo:write` with a scope-widening error before the tool call is emitted. The blast radius is contained to the planner's own compromised reasoning, not propagated to the sandboxed coder. When it is not enforced, the failure is not a crash but a **silent privilege escalation with a valid-looking audit trail** — the worst class of agent-identity failure, because post-hoc forensics see a well-formed chain and must reconstruct the missing per-hop check to explain the breach. The operational rule that follows: never authorize a delegated agent on the basis of root-subset containment; authorize only on the recomputed chain intersection, and treat any unresolvable ancestor as a denial. ```python from dataclasses import dataclass from typing import Mapping class ScopeWideningError(RuntimeError): """Raised when a delegated warrant claims a scope not contained in its parent's effective scope.""" class ChainResolutionError(RuntimeError): """Raised when an ancestor warrant cannot be resolved to a signature-verified body.""" @dataclass(frozen=True) class Warrant: subject: str scopes: frozenset[str] parent_attestation: str | None body_digest: str def effective_scope(chain: list[Warrant]) -> frozenset[str]: """Chain is ordered leaf-first. Returns intersection of all warrant scopes.""" if not chain: raise ChainResolutionError("empty warrant chain") effective = chain[0].scopes for child, parent in zip(chain, chain[1:]): if child.parent_attestation != parent.body_digest: raise ChainResolutionError( f"attestation mismatch: {child.subject} -> {parent.subject}" ) if not child.scopes <= parent.scopes: raise ScopeWideningError( f"{child.subject} claims {sorted(child.scopes - parent.scopes)} " f"not delegated by {parent.subject}" ) effective &= parent.scopes return effective def authorize_tool_call(chain: list[Warrant], required: frozenset[str]) -> None: effective = effective_scope(chain) if not required <= effective: raise ScopeWideningError( f"tool requires {sorted(required - effective)} beyond effective scope" ) # proceed to emit the tool call ```