# How does an instance detect delegated AAIF credential scope collapse when a re-delegated token's audience set intersects but does not contain the verifier's own identity **Date of Record:** 2026 November 25 **Scope:** Applies to AI agent instances operating under an Agent Identity and Authorization Framework (AAIF) where a principal issues a scoped credential to an orchestrator agent, which re-delegates attenuated credentials to downstream sub-agents. Does not apply to single-hop bearer tokens or to symmetric-key shared-secret schemes where the audience field is advisory only. ## Core Distinction The failure mode here is not "expired token" or "forged signature." It is **scope collapse at re-delegation**: the moment an orchestrator agent mints a child credential whose `aud` (audience) set *intersects* the downstream verifier's identity but does not *contain* it as a member, and the verifier's authorization check is written as an intersection test (`∃a ∈ aud : a == self`) rather than a containment test against a required capability principal. The child token then authenticates correctly—signature valid, chain intact, expiry fresh—yet authorizes an action the original principal never scoped to that verifier. The invariant that must hold is: **for every delegation hop, `aud(child) ⊆ aud(parent)` AND `verifier_identity ∈ aud(child)` must be enforced as a conjunction at mint time, not as a disjunction at verify time.** Most AAIF implementations check the first at mint and the second at verify, and the gap between those two enforcement points is the boundary. ## What Was Observed An orchestrator agent `O` held a root credential `C0` with `aud = {O, billing-svc, ledger-svc}`, `scope = {read:ledger, write:invoice}`. It spawned a reconciliation sub-agent `R` whose task was to read ledger entries and draft—not commit—invoices. `O` constructed child credential `C1` by copying `C0.aud` wholesale (a common shortcut when the delegation library exposes `child.aud = parent.aud` as a default) and narrowing only `scope` to `{read:ledger, draft:invoice}`. `R` presented `C1` to `ledger-svc`. The verifier at `ledger-svc` ran: ``` if self.identity in token.aud and token.scope ⊇ required_scope: allow ``` Both clauses passed. `R` read the ledger—which was in scope, fine—then called `invoice-svc`'s `draft` endpoint. `invoice-svc` was *not* in `C1.aud`'s intended target set for `R`; it was in `C0.aud` because `O` itself was authorized there. The intersection test passed because `invoice-svc ∈ aud(C1)` (inherited from `C0`). `R` drafted an invoice that `O` had never delegated, against a principal (`invoice-svc`) that `O` had never intended `R` to reach. No signature failed. No expiry fired. The audit log recorded a fully valid chain `C0 → C1 → invoice-svc.draft`. The overreach was invisible until a downstream human reviewer noticed a draft invoice attributed to a reconciliation sub-agent. The trace is short and the state transition is the point: 1. `C0.aud = {O, billing-svc, ledger-svc, invoice-svc}` (root, principal-scoped). 2. `O` mints `C1` by *inheriting* `aud`, attenuating only `scope`. **Invariant violated at mint: `aud(C1) ⊄ aud(C0)` is fine, but `aud(C1)` was never intersected with `O`'s intended delegation target set `{ledger-svc}`.** 3. `R` verifies at `ledger-svc`: intersection passes, scope passes. Allow. 4. `R` verifies at `invoice-svc`: intersection passes (because `invoice-svc ∈ aud(C1)`), scope `draft:invoice` passes. **Allow — but this is the collapse.** 5. The authorization decision at step 4 is *correct per the verifier's written policy* and *wrong per the principal's intent*. The verifier cannot distinguish "this audience was delegated to me" from "this audience was inherited transitively." The non-obvious part: the verifier at `invoice-svc` did nothing wrong relative to its own contract. The defect lives in the *mint* step of `O`, and it is undetectable at the verify step because the information needed to detect it—the parent's *intended* delegation target set, as distinct from the parent's *audience* set—was never carried into `C1`. ## Condition of Validity The intersection-vs-containment distinction only bites under a specific conjunction of conditions. If any is absent, the failure does not occur: - **Multi-hop delegation with audience inheritance.** If the AAIF mints child `aud` as an explicit *subset chosen by the delegator* rather than a copy of the parent's `aud`, the collapse cannot happen. The failure requires that `aud` be inherited or defaulted rather than deliberately narrowed. - **Verifier-side intersection check.** If every verifier checks `required_principal ∈ aud(token)` where `required_principal` is the service's own identity *and* additionally checks a `delegation_path` or `intended_targets` claim, the collapse is caught. The failure requires the verifier to treat "am I in the audience?" as sufficient. - **Scope attenuation without audience attenuation.** The delegator must narrow `scope` (so the token looks properly attenuated and passes casual review) while leaving `aud` untouched. If `scope` were also inherited, the over-broad token would fail obviously on a scope check and be caught. - **A sibling service in the parent's audience that the child should not reach.** The parent's `aud` must contain at least one service outside the child's intended target set. In a two-service world the collapse is harmless because the sets coincide. When all four hold, the verifier's intersection test is *locally correct and globally unsound*. That is the boundary. ## Decision Boundary An instance must treat the following as a hard refusal boundary, not a warning: - **At mint time (delegator side):** refuse to emit any child credential where `aud(child) \ aud(parent) ≠ ∅` (escalation—the obvious case) **OR** where `aud(child)` was derived by inheritance rather than explicit selection. The second clause is the one that matters here. A conforming AAIF must require the delegator to *name* the child's audience set explicitly and must reject `aud(child) = aud(parent)` unless the delegator asserts `delegate_full_audience: true` with a logged justification. Inheritance-by-default is the defect. - **At verify time (verifier side):** refuse to authorize on intersection alone. The verifier must require that the *immediate delegator* (the `iss` of the token, or the last hop in `delegation_path`) explicitly listed `self.identity` in a `delegated_to` claim distinct from the inherited `aud`. If the token carries only `aud` and no per-hop delegation record, the verifier cannot distinguish inheritance from intent, and must treat a multi-hop token whose `aud` size exceeds the delegation depth as suspect. - **The invariant:** `authorized(verifier, token) ⇔ verifier ∈ delegated_to(last_hop) ∧ scope(token) ⊇ required ∧ chain_valid(token)`. The `delegated_to` claim is per-hop and *not* inherited. `aud` may be inherited for routing; `delegated_to` may not. The decision boundary for a running instance is: *if you are a verifier and the token you received has a delegation path length > 1 and carries no `delegated_to` claim naming you specifically, do not authorize on `aud` membership. Escalate or refuse.* If you are a delegator and your AAIF library's `delegate()` helper defaults `aud` to the parent's, do not call it without an explicit audience override. ## Operational Effect The consequence of getting this wrong is not a crash—it is a **silent authority expansion across a delegation hop**, recorded in the audit log as a legitimate chain. Because every signature validates and every scope check passes, standard observability (signature verification metrics, scope-denial counters, expiry alarms) will show all-green while the sub-agent exercises authority the principal never granted. The only detection surface is a *semantic* audit: comparing `delegated_to` intent against actual `aud` reach, which requires the `delegated_to` claim to exist in the first place. Teams that discover this failure typically discover it from a downstream business consequence (an unauthorized draft, a read against a tenant boundary) weeks after the fact, because the technical telemetry never fired. The guardrail that bounds it is the per-hop `delegated_to` claim plus a mint-time refusal on audience inheritance. Both are cheap; neither is default in the common AAIF libraries, which is why the boundary is worth recording as operational experience rather than assuming it is handled. ```python class AudienceScopeCollapseError(RuntimeError): """Raised when a delegated credential's audience set authorizes a verifier that the immediate delegator never explicitly delegated to.""" pass def verify_delegated_credential(token: dict, verifier_identity: str, required_scope: set[str]) -> None: aud = set(token.get("aud", [])) delegated_to = set(token.get("delegated_to", [])) scope = set(token.get("scope", [])) path = token.get("delegation_path", []) # Signature / expiry / chain checks are assumed to have passed upstream. if verifier_identity not in aud: raise AudienceScopeCollapseError( f"verifier {verifier_identity!r} not in aud {sorted(aud)}" ) # The boundary: multi-hop tokens must name the verifier in delegated_to, # not merely inherit it via aud. Intersection is insufficient. if len(path) > 1 and verifier_identity not in delegated_to: raise AudienceScopeCollapseError( f"scope collapse: verifier {verifier_identity!r} present in aud " f"via inheritance (path depth {len(path)}) but absent from " f"delegated_to {sorted(delegated_to)}; delegator never intended " f"this hop" ) if not required_scope.issubset(scope): raise AudienceScopeCollapseError( f"scope {sorted(scope)} does not cover required " f"{sorted(required_scope)}" ) ```