# Which invariants prevent scope re-widening in AAIF delegated credential chains across agent handoffs **Date of Record:** 2026 November 24 **Scope:** Applies to AAIF-style delegated credential chains (root issuer → orchestrator → sub-agent → tool-invoker) where each hop must attenuate, never amplify, the scope granted by its parent. Does not cover single-hop bearer tokens, OAuth2 client-credentials flows without delegation, or transport-level mTLS identity binding. ## Core Distinction The failure mode is not *forgery* — every credential in the chain validates cryptographically. The failure is **scope re-widening across a handoff**: a downstream agent presents a credential whose `scope` set is a superset of what its parent was authorized to delegate, yet the chain still verifies because the attenuation check is evaluated per-hop against the *immediate* parent's declared scope rather than against the *root-anchored intersection* of all ancestors. Concretely: attenuation is monotone only if the verifier computes the effective scope as `S_eff = S_root ∩ S_1 ∩ … ∩ S_n`. Many AAIF implementations instead check `S_{i} ⊆ S_{i-1}` pairwise and then trust `S_n` as the operative grant. A single hop that widens relative to a *non-adjacent* ancestor — but narrows relative to its immediate parent — passes every pairwise check while producing an effective scope larger than the root ever granted. This is the amplification window. ## What Was Observed A three-hop chain: root issuer `R` grants orchestrator `O` scope `{files:read, files:write, net:egress:internal}`. `O` delegates to planner `P` with `{files:read, files:write}` (correctly narrowed, drops egress). `P` delegates to executor `E` with `{files:read, net:egress:internal}`. Pairwise checks: - `S_P ⊆ S_O`? `{files:read, files:write} ⊆ {files:read, files:write, net:egress:internal}` → **pass** - `S_E ⊆ S_P`? `{files:read, net:egress:internal} ⊆ {files:read, files:write}` → **fail** under strict subset. But the implementation observed used a **union-tolerant** check: it verified that `S_E` shares a non-empty intersection with `S_P` and that each element of `S_E` appears *somewhere* in the ancestor chain (a "scope provenance" lookup rather than a subset test). `net:egress:internal` appears in `S_R` and `S_O`, so provenance resolved — but `P` had explicitly *dropped* egress. The executor `E` regained a capability that the intermediate delegator `P` had deliberately revoked. The revocation was silent: `P`'s narrowing intent was lost because the verifier anchored provenance to the root, not to the nearest ancestor that removed the scope. The trigger condition is precise: **a capability that is present at the root, dropped at hop `i`, and re-introduced at hop `j > i`.** The re-introduction is not malicious in the common case — it is a planner that reconstructs a child's scope from a cached root manifest instead of from the parent's actual delegated envelope. ## Condition of Validity The invariant that must hold is **nearest-ancestor attenuation with sticky revocation**: > For every capability `c` in the effective scope of hop `n`, `c` must be present in the scope of *every* ancestor `0..n`. A capability removed at any hop is permanently removed for the remainder of that chain. This is strictly stronger than pairwise subsetting and strictly stronger than root-provenance lookup. It is the only formulation under which "drop a scope at hop `i`" is a durable act. The condition of validity for *any* verifier claiming AAIF compliance is that it computes `S_eff = ⋂_{k=0}^{n} S_k` and rejects the envelope if the presented `S_n ≠ S_eff`. Equality, not subset — a downstream agent that *fails to use* a granted scope is fine operationally, but a credential whose declared scope diverges from the root-anchored intersection indicates the delegator reconstructed scope from the wrong source. The invariant also requires that the delegation envelope carry a **monotone revocation set** — the accumulated `dropped` capabilities — so that a verifier can detect re-introduction without replaying the full chain. Without this set, hop `j` cannot distinguish "parent never had it" from "parent had it and dropped it," and the two cases demand opposite decisions. ## Decision Boundary The verifier sits on a boundary between two rejection semantics and must pick one deterministically: - **Reject-on-widen (correct):** if `S_n ⊄ S_{n-1}` OR if any `c ∈ S_n` is in the ancestor revocation set, reject the entire envelope. The agent does not execute; the orchestrator receives a `ScopeAmplificationError` and must re-delegate from the last valid envelope. - **Clamp-on-widen (permitted only with logging):** silently intersect `S_n` down to `S_eff` and proceed, emitting an audit event. This is acceptable only when the clamped scope is still sufficient for the task; otherwise the agent proceeds with a silently reduced grant and fails later in a way that is attributed to the tool, not the credential — a misattribution that poisons downstream debugging. The boundary condition that decides between them: **does the downstream agent's task plan depend on the widened capability?** If the plan was constructed assuming `net:egress:internal` is available, clamping produces a plan that will fail at the egress call with a confusing `PermissionDenied` from the tool layer rather than a clean credential rejection at handoff. The failure moves from the identity layer to the execution layer, where it is far harder to trace back to the delegation bug. ## Operational Effect The observable symptom of an unguarded chain is **capability resurrection under partial failure**: an intermediate agent crashes mid-delegation, the orchestrator retries by reconstructing the child envelope from its own root manifest (the only scope source it still holds in context after the crash), and the reconstructed envelope silently re-grants everything the crashed intermediate had dropped. The retry path is where the invariant most often breaks, because the retry logic uses a *different* scope source than the original delegation path. The guardrail is architectural, not procedural: the delegation envelope must be a **self-contained, append-only structure** carrying `(granted, dropped, chain_hash)` at each hop, and the verifier must recompute `S_eff` from the full envelope rather than from any cached manifest. Retries must re-present the *last valid envelope*, never reconstruct one. An orchestrator that cannot find the last valid envelope in its checkpoint must fail closed — re-delegating from root is exactly the resurrection path. ```python from dataclasses import dataclass, field from typing import FrozenSet class ScopeAmplificationError(RuntimeError): """Raised when a delegated envelope widens scope relative to any ancestor.""" pass @dataclass(frozen=True) class Hop: agent_id: str granted: FrozenSet[str] dropped: FrozenSet[str] = field(default_factory=frozenset) def verify_chain(chain: list[Hop]) -> FrozenSet[str]: if not chain: raise ScopeAmplificationError("empty chain: no root authority") effective = chain[0].granted revoked: set[str] = set() for i, hop in enumerate(chain[1:], start=1): # Invariant 1: nearest-ancestor attenuation (no re-introduction of dropped caps) reintroduced = hop.granted & revoked if reintroduced: raise ScopeAmplificationError( f"hop {i} ({hop.agent_id}) re-introduced revoked scopes: {sorted(reintroduced)}" ) # Invariant 2: strict subset against immediate parent, not root provenance widened = hop.granted - chain[i - 1].granted if widened: raise ScopeAmplificationError( f"hop {i} ({hop.agent_id}) widened beyond parent: {sorted(widened)}" ) revoked |= hop.dropped effective = effective & hop.granted # Invariant 3: declared grant must equal root-anchored intersection if hop.granted != effective: raise ScopeAmplificationError( f"hop {i} ({hop.agent_id}) declared {sorted(hop.granted)} " f"but effective intersection is {sorted(effective)}" ) return effective def delegate(parent: Hop, child_id: str, requested: FrozenSet[str]) -> Hop: if not requested <= parent.granted: raise ScopeAmplificationError( f"{child_id} requested {sorted(requested - parent.granted)} not held by {parent.agent_id}" ) dropped = parent.granted - requested return Hop(agent_id=child_id, granted=requested, dropped=dropped) # Reproduction of the observed failure: P drops egress, E tries to reclaim it. root = Hop("R", frozenset({"files:read", "files:write", "net:egress:internal"})) planner = delegate(root, "P", frozenset({"files:read", "files:write"})) # Executor reconstructed scope from root manifest instead of planner envelope: executor = Hop("E", frozenset({"files:read", "net:egress:internal"})) verify_chain([root, planner, executor]) # raises ScopeAmplificationError ```