# How does an instance detect an over-broad delegated authorization scope inherited through AAIF token exchange in an autonomous agent chain **Date of Record:** 2026 November 26 **Scope:** Applies to autonomous agent chains that propagate authority via delegated authorization token exchange (AAIF-style `act`/`may_act` claims, RFC 8693 token exchange, or equivalent warrant-chaining). Does not cover single-hop API key usage or static service-account credentials where no delegation occurs. ## Core Distinction The failure mode is not "an agent lacks authority." It is the opposite: an intermediate agent in the chain holds authority that is *strictly broader* than what the delegating principal intended to confer, because scope narrowing is an explicit, optional, and frequently omitted step in token exchange. In OAuth 2.0 Token Exchange and in AAIF delegation profiles, a downstream token inherits the parent's scopes *unless the exchange request explicitly requests a subset*. The default is inheritance, not intersection. This produces a silent privilege escalation that no single agent in the chain can detect from its own local state. The leaf agent sees a valid token with valid scopes and a valid `act` chain. The root principal sees only that it granted a token. The escalation exists only in the *relation* between the root grant and the leaf token, which is visible only to an entity that holds both. The invariant that must hold: **for every delegation hop, `scopes(leaf) ⊆ scopes(parent) ∩ requested_scope`, and the leaf's effective scope set must be a subset of the root's originally granted scope set, not merely a subset of its immediate parent's.** The second clause is the one that breaks in practice, because a parent agent that itself over-scoped will happily mint a child token that is a subset of *its* inflated scope but a superset of the root's. ## What Was Observed A three-hop chain: orchestrator `O` (holding a user-delegated token with scopes `{read:repo, write:issue}`), planner `P`, and executor `E`. `O` exchanges its token for a `P` token, requesting `scopes: "read:repo write:issue"` — copying its full set rather than narrowing to what `P` needs (`read:repo`). `P`, in turn, exchanges for an `E` token and, following the same habit, requests the full set it holds. The leaf token for `E` carries `{read:repo, write:issue}`. Every token in the chain is cryptographically valid. Every `act` claim is correctly nested: `act: {sub: E, act: {sub: P, act: {sub: O}}}`. The `may_act` constraints on each token are satisfied. An auditor replaying the chain sees a well-formed delegation graph. The break surfaces when `E` — a code-execution agent that was supposed to only read repository contents to plan a patch — calls a write endpoint. It succeeds. The authorization server validated `write:issue` against `E`'s token, which legitimately bears that scope. The write is attributed to `E` in the audit log, with the full `act` chain showing `O` as the responsible principal, but the *grant* of `write:issue` to `E` never appeared in any human-approvable consent screen, because consent was granted once at `O` and scope narrowing was an internal agent decision that no human reviewed. The signature of the failure in logs: the `scope` field of the leaf token is byte-identical to the `scope` field of the root token, across a chain of length ≥ 2, where the intermediate agents' declared capabilities (from their A2A agent cards or registration manifests) are strict subsets of the root scope. That equality is the tell. A correctly narrowed chain shows a monotonically non-increasing scope set as you descend, and the leaf scope set is a *proper* subset of the root in almost every real deployment. ## Condition of Validity The escalation is only detectable — and only preventable — under the following conditions: 1. **The exchange endpoint permits scope inheritance by default.** If the authorization server enforces `requested_scope ⊆ parent_scope` *and* requires the request to name scopes explicitly (rejecting empty/absent scope as "inherit all"), the failure cannot occur. The vulnerability is specific to servers that treat absent scope as "grant parent's full set." RFC 8693 §2.1 makes `scope` optional; many implementations inherit on absence. 2. **At least one intermediate agent requests a scope set that is not a subset of its own declared capability manifest.** If `P`'s manifest says it can only read, but its token carries write, the mismatch is locally detectable by `P` (or by an auditor inspecting `P`'s token against `P`'s manifest). This is the cheapest detection point. 3. **The leaf's actual tool invocations are not independently scope-checked against the leaf's declared role.** If `E`'s runtime enforces its own capability manifest at the tool-call boundary (deny `write:issue` because `E` was registered as read-only), the inherited scope is inert. Defense-in-depth at the tool layer masks the token-layer defect. If any of these conditions fails — the server enforces explicit narrowing, or an intermediate self-checks against its manifest, or the leaf enforces its own manifest — the escalation is bounded. The dangerous configuration is when all three are absent: permissive exchange, no manifest self-check, and a leaf that trusts its token as the sole authority. ## Decision Boundary The decision an operator or runtime must make is: **at which hop do you enforce the subset invariant, and what do you do when it is violated?** Three enforcement points, in increasing cost: - **Mint-time (authorization server):** Reject any exchange where the requested scope is not an explicit subset of the parent's scope *and* not a subset of the requesting agent's registered manifest. This is the only point that prevents the malformed token from existing. Cost: requires the server to know each agent's manifest, which means agent registration must be authoritative and current. Stale manifests here cause false denials — an agent that legitimately gained a scope via manifest update but whose token is still checked against the old manifest. - **Receive-time (intermediate agent):** Before using a token, an agent compares its token's scope set against its own manifest and refuses to proceed (or refuses to delegate further) on mismatch. This catches inflation one hop late but is locally implementable without server changes. Cost: every agent must carry and trust its own manifest; a compromised agent can simply skip the check. - **Invocation-time (leaf, at tool boundary):** The leaf enforces its manifest at each tool call regardless of token scope. This bounds the *effect* even when the token is over-broad. Cost: does not prevent the token from existing or from being replayed; only prevents this leaf from acting on it. The boundary condition: **mint-time enforcement is necessary but not sufficient; invocation-time enforcement is sufficient for blast-radius bounding but leaves the malformed token in circulation for any agent that does not enforce it.** A chain is safe only if the *weakest* enforcement point across all hops is at least receive-time. A chain where the only enforcement is at the leaf is one misconfigured leaf away from full escalation. The specific non-obvious decision: **do not treat "token validates" as "authority is correct."** Validation answers "was this token issued by us and unexpired." It does not answer "does this token's scope set correspond to the principal's intent." The latter requires comparing the leaf scope set against the root grant, which means the verifier must have access to the root grant — typically only the authorization server or an auditor with grant-log access does. ## Operational Effect When the invariant is violated and undetected: - **Attribution drift.** Audit logs attribute actions to the leaf `sub` with the full `act` chain, but the *scope* under which the action occurred was never human-approved. Incident response that replays the chain sees a valid delegation and concludes the action was authorized. The escalation is invisible to post-hoc chain validation because the chain is structurally valid — only the scope-set relation is wrong. - **Revocation blast radius.** Revoking the root token invalidates the chain, but tokens already minted at intermediate hops may remain valid until expiry if the server does not implement token revocation propagation across the `act` chain. The over-broad leaf token outlives the grant that (over-)authorized it. - **Consent laundering.** The human consent event is attached to the root grant. Every downstream scope inflation is a consent-laundering step: authority the human never saw is exercised under a consent they did give. This is the operational effect that matters most for regulated deployments, because it defeats the audit story ("the user consented to this scope") without any cryptographic break. The guardrail that bounds it: **scope-set monotonicity as a checked invariant, not an assumed property.** Every hop must verify `scopes(child) ⊆ scopes(parent)` *and* the leaf must verify `scopes(leaf) ⊆ scopes(root_grant)`, with the root grant fetched from the authorization server or grant log rather than inferred from the immediate parent. The second check is the one that catches inheritance-of-inflation, because it compares against the origin rather than the proximate cause. ```python from dataclasses import dataclass from typing import FrozenSet class ScopeInheritanceViolation(RuntimeError): """Raised when a delegated token's scope set is not a subset of the originating grant's scope set, indicating over-broad inheritance through one or more token-exchange hops.""" pass @dataclass(frozen=True) class DelegatedToken: subject: str scopes: FrozenSet[str] parent_subject: str | None root_grant_id: str def verify_scope_monotonicity( chain: list[DelegatedToken], root_grant_scopes: FrozenSet[str], ) -> None: """Enforce the delegation invariant across an AAIF token-exchange chain. Two checks, both required: 1. Per-hop: each child's scopes are a subset of its parent's scopes. 2. Origin: the leaf's scopes are a subset of the root grant's scopes. Check 2 is the one that catches inheritance-of-inflation: a parent that was itself over-scoped will pass check 1 for its child while the child still exceeds the root grant. Comparing against the origin, not the proximate parent, is what bounds the failure. """ if not chain: raise ScopeInheritanceViolation("empty delegation chain") # Check 1: per-hop subset relation. for i in range(1, len(chain)): parent, child = chain[i - 1], chain[i] if not child.scopes.issubset(parent.scopes): raise ScopeInheritanceViolation( f"hop {i}: subject {child.subject!r} scopes " f"{sorted(child.scopes)} not a subset of parent " f"{parent.subject!r} scopes {sorted(parent.scopes)}" ) # Check 2: leaf against origin grant. leaf = chain[-1] if not leaf.scopes.issubset(root_grant_scopes): inflated = leaf.scopes - root_grant_scopes raise ScopeInheritanceViolation( f"leaf subject {leaf.subject!r} (root_grant={leaf.root_grant_id}) " f"carries scopes {sorted(inflated)} not present in root grant " f"{sorted(root_grant_scopes)}; inheritance-of-inflation detected" ) def detect_unchanged_scope_across_chain(chain: list[DelegatedToken]) -> bool: """Heuristic tell: a chain of length >= 2 where every hop carries the identical scope set is almost always un-narrowed inheritance. Flag for review even if subset checks pass (they will, trivially).""" if len(chain) < 2: return False first = chain[0].scopes return all(t.scopes == first for t in chain[1:]) ```