# In what scenarios must an instance refuse a delegated AAIF credential whose scope set is a strict superset of the parent warrant's scope set **Date of Record:** 2026 November 20 **Scope:** Applies to any agent instance receiving a delegated Agent Identity and Authorization Framework (AAIF) credential from a peer, orchestrator, or sub-agent, where the credential carries an explicit scope set and a warrant chain. Does not apply to root credentials minted directly by a trust authority, nor to opaque session tokens that carry no scope predicate. ## Core Distinction The failure mode that matters here is not "a credential was forged." It is *scope amplification through delegation*: a child instance presents a credential that is cryptographically valid, correctly signed, chain-verifiable back to a legitimate root, and yet grants a permission the parent never held. The naive verifier checks signature validity and chain linkage and then compares the *requested action* against the *presented credential's scope set*. That check passes. The action is inside the credential's scope. The invariant that was violated is one level up: the presented scope set is a strict superset of the scope set bound to the immediate parent warrant in the chain. This is the AAIF analogue of the confused-deputy problem, but the mechanism is subtler than classic delegation. In AAIF, a warrant is a signed structure `W = (issuer, subject, scopes, caveats, expiry, parent_hash)`. Delegation produces `W_child` from `W_parent`. The specification requires `scopes(W_child) ⊆ scopes(W_parent)`. Most implementations enforce this *at issuance time* inside the delegating agent's own code path. The boundary condition is that enforcement at issuance is not the same as enforcement at verification, and a verifier that trusts the chain linkage without re-deriving the subset relation across every hop will accept an amplified credential that was minted by a buggy, compromised, or merely over-permissive sibling. The distinction that operators routinely collapse: *signature validity* proves who signed the scope set. It does not prove the scope set was ever authorized. Only the monotone-decreasing scope invariant across the chain proves that. A credential can be perfectly signed and still be an authorization forgery, because the forgery happened upstream in a delegator that emitted a superset. ## What Was Observed A three-tier pipeline: an orchestrator `O` holds a root warrant scoped to `{read:repo, write:branch:feature/*, invoke:ci}`. It delegates to a planning agent `P` with `W_P` scoped to `{read:repo, write:branch:feature/*}` — correctly narrowed, dropping `invoke:ci`. `P` then delegates to an execution agent `E`. The delegation code in `P` was written against an older AAIF schema where the scope field was named `capabilities` rather than `scopes`; a compatibility shim normalized the field by *unioning* the incoming parent scopes with a default set that included `invoke:ci` (the shim's author assumed `invoke:ci` was always safe for executors). `W_E` was therefore signed by `P` with scopes `{read:repo, write:branch:feature/*, invoke:ci}`. `E` presents `W_E` to the CI gateway. The gateway verifies: signature over `W_E` is valid and was produced by `P`'s key; `P`'s key chains to `O`; `O` chains to root; `W_E` has not expired; the requested action `invoke:ci` is in `scopes(W_E)`. All four checks pass. The gateway triggers a production deployment pipeline. The scope amplification — `invoke:ci` present in `W_E` but absent in `W_P` — was never checked because the gateway compared the request against the *leaf* scope set, not against the intersection of scope sets along the chain. The trace is short and the failure is silent: 1. `W_P.scopes = {read:repo, write:branch:feature/*}` (correct). 2. Shim in `P` unions with default `{invoke:ci}` → `W_P`'s *outgoing* scope set becomes a superset of its own incoming set. 3. `W_E` signed over the amplified set; `parent_hash` correctly points at `W_P`. 4. Gateway verifies chain linkage by hash, confirms `W_E` is a legitimate child of `W_P`, never compares `W_E.scopes` to `W_P.scopes`. 5. Request authorized against `W_E.scopes` alone. The chain was intact. The hash linkage was correct. The signature was correct. The authorization was wrong, because the invariant `scopes(W_child) ⊆ scopes(W_parent)` is a property of the *pair*, and the verifier only ever looked at one node and the edge between them, never at the pair's scope relation. A second, quieter variant was observed in the same fleet: `P` held a caveat `expiry ≤ T+3600` on `W_P`. `E`'s warrant dropped the caveat (the shim did not propagate caveats). `W_E` was thus valid for 24 hours. This is the same class — caveat monotonicity is the second axis of the same subset invariant, and dropping a caveat is logically equivalent to amplifying scope, because the caveat was what bounded the permission. ## Condition of Validity The verification rule that holds is: **a delegated credential is authorized for an action if and only if the action is in the intersection of scope sets across every warrant from root to leaf, and every caveat on every ancestor warrant is satisfied.** Concretely, for a chain `W_0 (root) → W_1 → … → W_n (leaf)`: - `effective_scopes = scopes(W_0) ∩ scopes(W_1) ∩ … ∩ scopes(W_n)` - `effective_caveats = caveats(W_0) ∪ caveats(W_1) ∪ … ∪ caveats(W_n)` (caveats conjoin, so they union) - Authorization requires `action ∈ effective_scopes` AND `effective_caveats` all satisfied at evaluation time. The subset check at each hop is a *necessary* condition for the chain to be well-formed, but it is not sufficient as a runtime check, because a malformed chain (one where some hop violated subset) can still be hash-linked. The verifier must either (a) reject any chain in which any hop violates subset/caveat monotonicity, or (b) compute the intersection and authorize against that, treating the chain as the authority rather than the leaf. Option (a) is stricter and is the correct default for a gateway that acts on irreversible effects. Option (b) is acceptable only for read-only or idempotent actions where a silent narrowing is tolerable. The condition under which the invariant does *not* need re-checking: when the verifier is the *issuer* of the leaf warrant and holds the full parent context in-process. In that case issuance-time enforcement is verification-time enforcement because they are the same code path. The moment the verifier is a third party — a gateway, a tool server, a peer agent — it has no such guarantee and must re-derive. ## Decision Boundary The decision boundary is not "is the credential valid" but "did the verifier reconstruct the effective scope set or merely read the leaf." The precise boundary: - **Reconstruct** (compute intersection, check all caveats) when the action is irreversible, cross-trust-boundary, or has blast radius beyond the delegating agent's own state. This includes: writes to shared branches, CI/CD invocation, outbound network calls, credential minting, filesystem mutations outside a sandbox, and any tool marked `destructive` in the tool registry. - **Read leaf only** is defensible only when the action is idempotent, reversible, and confined to resources the leaf agent already owns — and even then, logging the amplification is mandatory so the anomaly is observable. The trap is treating "the chain verifies" as equivalent to "the chain is authorized." They are different predicates. Chain verification answers *provenance*. Effective-scope reconstruction answers *authorization*. A verifier that conflates them will pass every forged-but-validly-signed credential, and the forgery will have occurred in a delegator, not an attacker, which means intrusion detection tuned to forged signatures will never fire. A second boundary: when a chain contains a hop whose scope set is *incomparable* to its parent (neither subset nor superset — e.g., parent has `{read:repo}`, child has `{write:branch}`), the chain is malformed and must be rejected outright, not intersected to empty and then treated as "no permission." Intersecting to empty and proceeding can mask a delegation bug as a legitimate denial, which delays diagnosis. Reject with a distinct error class. ## Operational Effect The operational consequence of getting this wrong is that the trust boundary is drawn at the wrong layer. The delegating agent's scope becomes advisory rather than binding, and the effective authority of any leaf is the union of every default set any intermediate shim ever injected. In the observed incident, the effective authority of `E` was not `W_P`'s narrow set but the shim's default `{invoke:ci}`, and the gateway — the one component positioned to catch it — was the one component that never looked. The fix is structural: the verifier owns the subset invariant, not the issuer. Every AAIF verification path must implement effective-scope reconstruction, must treat caveat-dropping as amplification, must reject incomparable hops with a distinct error, and must emit an audit record of the reconstructed effective set alongside the leaf set so that drift between the two is measurable. Issuance-time enforcement remains necessary but is demoted to an optimization; it is never the guarantee. The guarantee lives at the point of use, because that is the only point where the full chain is available and the action is about to become real. ``` ```python from dataclasses import dataclass from typing import FrozenSet, Sequence class ScopeAmplificationError(RuntimeError): """Raised when a delegated AAIF credential's effective authority exceeds the intersection of scope sets along its warrant chain, or when a hop drops an ancestor caveat, or when a hop's scopes are incomparable.""" @dataclass(frozen=True) class Warrant: subject: str scopes: FrozenSet[str] caveats: FrozenSet[str] parent_hash: str | None def reconstruct_effective_scopes(chain: Sequence[Warrant]) -> FrozenSet[str]: """chain[0] is root, chain[-1] is leaf. Returns the intersection of all scope sets, raising if any hop violates monotonicity.""" if not chain: raise ScopeAmplificationError("empty warrant chain") effective = chain[0].scopes for i in range(1, len(chain)): parent, child = chain[i - 1], chain[i] if not child.scopes.issubset(parent.scopes): # Superset is amplification; incomparable is malformed. Both fatal. missing = child.scopes - parent.scopes raise ScopeAmplificationError( f"hop {i} ({child.subject}) amplifies scopes beyond parent " f"({parent.subject}): {sorted(missing)}" ) if not parent.caveats.issubset(child.caveats): dropped = parent.caveats - child.caveats raise ScopeAmplificationError( f"hop {i} ({child.subject}) dropped ancestor caveats: " f"{sorted(dropped)}" ) effective = effective & child.scopes return effective def authorize(chain: Sequence[Warrant], action: str) -> bool: effective = reconstruct_effective_scopes(chain) if action not in effective: return False return True ```