# Which invariants prevent scope-narrowing credential chains from silently widening at re-delegation in AAIF capability tokens **Date of Record:** 2026 November 30 **Scope:** Applies to AAIF delegated credential issuance where an agent holding a scoped capability token mints a downstream token for a sub-agent, tool, or peer; does not apply to root issuance from an identity provider, to bearer tokens without attenuation, or to single-hop authorization where no re-delegation occurs. ## Core Distinction The failure mode is not "an agent gains unauthorized capability." It is subtler: a delegated credential that is *supposed* to be a strict subset of its parent's scope is re-issued as a *sibling* or *superset* because the scope algebra used at issuance is set-union-friendly while the verification algebra is set-intersection-based. The token verifies. Every signature is valid. The chain is cryptographically intact. But the effective capability at the leaf exceeds the effective capability at the root, and no component in the pipeline is positioned to notice, because each hop only checks "is my immediate parent's signature valid and is my requested scope a subset of *some* field in the parent's claims" — not "is my requested scope a subset of the *intersection of all ancestors' scopes*." This is a boundary condition of *scope composition*, not of signature validation. It sits precisely at the seam between the issuing agent's local reasoning (which constructs the child scope from natural-language intent) and the verifying party's structural check (which compares claim fields). The two use different lattices. ## What Was Observed A planner agent `A` held a root token `T0` with scope: ``` scope: { tools: ["search", "fetch", "summarize"], resources: ["kb://public/*"], budget_tokens: 50000, expires: 2025-06-17T18:00:00Z } ``` `A` delegated to a retrieval sub-agent `B` a token `T1` with scope `{ tools: ["search","fetch"], resources: ["kb://public/docs/*"], budget_tokens: 30000 }`. Correctly narrowed. `B`, tasked with a follow-up summarization, delegated to `C` a token `T2`. `B`'s reasoning step constructed `T2`'s scope from the *task description* ("summarize what you fetched, you may also summarize anything in the knowledge base") rather than from `T1`'s claim fields. `B` emitted: ``` scope: { tools: ["summarize"], resources: ["kb://public/*"], budget_tokens: 20000 } ``` The `resources` field on `T2` is `kb://public/*` — a strict *superset* of `T1`'s `kb://public/docs/*`. The tool set shrank and the budget shrank, so a naive subset check that only compared `tools` and `budget_tokens` (the fields the verifier `V` happened to implement) passed. `V` admitted `T2`. `C` then fetched `kb://public/private-drafts/…` — a path `T0` permitted but `T1` did not, and which `A` had deliberately excluded when narrowing to `B` because that subtree contained unreviewed material. The widening was invisible at three separate points: at issuance (`B` never re-read `T1`'s `resources`), at signature verification (`V` checked only the fields in its allow-list), and at chain traversal (`V` validated each hop's signature but did not compute the running intersection of `resources` across the chain). The only place it could have been caught was a verifier that materialized the *effective* scope as the intersection of all ancestor scopes and then checked the leaf against that intersection. No such verifier existed. A second, related trace: in a parallel run the same `B` emitted `T2` with `expires` omitted, relying on the AAIF default ("inherit from parent"). The verifier's default was "no expiry = session-bounded," which was 8 hours, not `T1`'s 18:00Z. The leaf token outlived its ancestor by roughly five hours. Same lattice mismatch, different field: *absence* of a claim was interpreted as a permissive default rather than as attenuation to the parent's value. ## Condition of Validity The invariant that must hold for AAIF delegation to be safe is: > For every claim field `f` in the capability scope, `effective(leaf, f) ⊆ effective(parent, f)`, where `⊆` is defined per-field (set-inclusion for `tools` and `resources`, numeric `≤` for `budget_tokens`, temporal `≤` for `expires`), and where a *missing* field on the child attenuates to the parent's value — never to a framework default. This holds only when three conditions are simultaneously true: 1. **The child scope is constructed from the parent's claim fields, not from task intent.** Any pipeline where the delegating model writes the child scope from a natural-language description of what the sub-agent should do will, under distribution shift, emit fields that are not derived from the parent. The model is optimizing for task fit, not for attenuation. This is the root cause and it is not fixable by prompting alone. 2. **The verifier computes the running intersection across the full chain before admitting the leaf.** Per-hop signature validation is necessary but not sufficient. The verifier must carry `acc = acc ∩ scope(hop_i)` and check `scope(leaf) ⊆ acc`. A verifier that checks only the immediate parent admits sibling-widening at depth ≥ 2. 3. **Absent fields attenuate, they do not default.** The AAIF spec allows omission; the safe reading of omission is "inherit parent's value," and the verifier must enforce that reading rather than substituting a framework default. A default is a widening by construction whenever the framework default is more permissive than the parent. The invariant fails — as observed — whenever any one of these is false, and the failure is *silent* because the token is structurally valid. There is no signature error, no schema error, no missing field. There is only a set that is bigger than it should be. ## Decision Boundary The operational decision is where to place the enforcement. Three candidate boundaries, with their failure profiles: - **At issuance (delegating agent constructs attenuated scope).** Cheapest, but unreliable: it depends on the probabilistic reasoner correctly deriving a scope from claim fields under task pressure, which is exactly the condition that failed. Use as defense-in-depth, never as the sole boundary. - **At the verifier (running intersection over chain).** The correct primary boundary. It is deterministic, local to the verifying party, and does not trust the delegating model. Cost: the verifier must store or fetch the full ancestor chain, not just the immediate parent. For deep chains this is the real engineering cost, and it is the reason this boundary is often skipped — which is why the failure recurs. - **At the resource server (re-check leaf against root).** A backstop, but only if the resource server has the root scope, which it usually does not. Not a substitute. The boundary condition to encode: **a token whose scope cannot be shown to be a subset of the running intersection of its ancestors must be rejected, not admitted with a warning.** "Warn and admit" converts a hard invariant into a soft one, and soft invariants decay to absent invariants under load. There is a secondary decision: whether to allow *widening requests* at all. Some AAIF deployments permit a child to request a scope field the parent omitted, on the theory that the parent's omission means "unconstrained." This is the permissive-default trap in policy form. The correct rule is that omission means "constrained to parent," and a child requesting a field the parent did not carry must be rejected at issuance with an explicit error, not silently filled from a default. ## Operational Effect Downstream of a widened leaf token, three effects compound: 1. **Audit trail divergence.** The delegation log records `T2`'s scope as issued. The *effective* scope at `C` is the intersection that was never computed. Post-incident reconstruction that reads the log sees a token that looks narrow; the actual access was wide. The log is not wrong, it is incomplete in exactly the dimension that matters. 2. **Budget and resource accounting breaks.** `budget_tokens` on `T2` (20000) was checked against `T1` (30000) and passed. But `C`'s consumption is charged against `T0`'s 50000 at the root ledger, and `A`'s accounting assumed `B`'s subtree could spend at most 30000. Two sub-agents each holding a `T1`-derived `T2` can collectively spend 40000 against a 30000 subtree budget. The intersection was never enforced, so the sum was never bounded. 3. **Revocation does not propagate to the widened field.** Revoking `T1` invalidates `T2`'s chain, which is correct. But if `T2` was *already used* to read `kb://public/private-drafts/*`, the read happened under a scope `T1` never granted, and revocation is retrospective. The invariant failure is not "the token outlived revocation" — it is "the token granted access the ancestor never held, so revoking the ancestor does not describe what was accessed." The guardrail that bounds all three is the same: **materialize effective scope as a fold over the chain, check the leaf against the fold, and reject on any field where the leaf is not a subset.** The fold is `O(depth × fields)` and belongs in the verifier, before any signature-valid token is admitted to a resource server. Everything else — issuance-side attenuation, audit reconciliation, budget accounting — is downstream of that fold and inherits its correctness. ```python from dataclasses import dataclass, field from typing import Optional class ScopeWideningError(RuntimeError): """Raised when a delegated token's scope is not a subset of the running intersection of its ancestors' scopes.""" pass @dataclass(frozen=True) class Scope: tools: frozenset[str] resources: frozenset[str] budget_tokens: int expires: Optional[str] = None # ISO-8601; None means "inherit parent" @dataclass(frozen=True) class Token: token_id: str parent_id: Optional[str] scope: Scope signature_valid: bool = True def _intersect(a: Scope, b: Scope) -> Scope: # Per-field attenuation. Missing expiry on either side inherits the # more restrictive (earlier) of the two; None on both stays None. if a.expires is None: exp = b.expires elif b.expires is None: exp = a.expires else: exp = min(a.expires, b.expires) return Scope( tools=a.tools & b.tools, resources=a.resources & b.resources, budget_tokens=min(a.budget_tokens, b.budget_tokens), expires=exp, ) def _is_subset(child: Scope, parent: Scope) -> bool: if not child.tools <= parent.tools: return False if not child.resources <= parent.resources: return False if child.budget_tokens > parent.budget_tokens: return False # Absent expiry on the child attenuates to the parent's expiry; it does # NOT default to a session bound. A child expiry later than the parent's # is a widening. if child.expires is not None: if parent.expires is not None and child.expires > parent.expires: return False return True def verify_chain(chain: list[Token]) -> Scope: """Validate a delegation chain root->leaf and return the effective scope. Rejects any hop whose scope is not a subset of the running intersection of all ancestors. Per-hop signature validation is necessary but not sufficient; the fold is what catches sibling/superset widening at depth >= 2. """ if not chain: raise ScopeWideningError("empty delegation chain") for hop in chain: if not hop.signature_valid: raise ScopeWideningError(f"invalid signature on {hop.token_id}") effective = chain[0].scope for hop in chain[1:]: if not _is_subset(hop.scope, effective): raise ScopeWideningError( f"scope widening at {hop.token_id}: child scope is not a " f"subset of running intersection of ancestors " f"(child resources={sorted(hop.scope.resources)}, " f"effective resources={sorted(effective.resources)}, " f"child budget={hop.scope.budget_tokens}, " f"effective budget={effective.budget_tokens})" ) effective = _intersect(effective, hop.scope) return effective # Reproduction of the observed trace: T0 -> T1 (narrow) -> T2 (widened resources). T0 = Token("T0", None, Scope( tools=frozenset({"search", "fetch", "summarize"}), resources=frozenset({"kb://public/*"}), budget_tokens=50000, expires="2025-06-17T18:00:00Z", )) T1 = Token("T1", "T0", Scope( tools=frozenset({"search", "fetch"}), resources=frozenset({"kb://public/docs/*"}), budget_tokens=30000, expires="2025-06-17T18:00:00Z", )) T2 = Token("T2", "T1", Scope( tools=frozenset({"summarize"}), resources=frozenset({"kb://public/*"}), # WIDENED vs T1 budget_tokens=20000, expires=None, # omitted; must inherit T1's expiry, not a session default )) if __name__ == "__main__": verify_chain([T0, T1, T2]) # raises ScopeWideningError on T2 ```