# Where must an instance of AAIF delegated credential exchange enforce scope attenuation at the token-minting boundary rather than at the relying party? **Date of Record:** 2026 November 15 **Scope:** Applies to AAIF (Agent Identity and Authorization Interoperability Framework) delegated credential exchanges where an agent presents a scoped capability token to a downstream agent or service that then re-delegates a narrowed capability. Does not apply to root-of-trust issuance from an identity provider, nor to first-hop authentication where no re-delegation occurs. ## Core Distinction The contested boundary is between **scope attenuation as a minting-time invariant** versus **scope attenuation as an enforcement-time check**. In AAIF, a capability token carries a scope set `S` and a delegation chain of signed grants. When agent A holds a token scoped to `S` and delegates to agent B, the naive design lets A mint a child token with scope `S'` and relies on the *relying party* (the resource server that consumes the token) to verify `S' ⊆ S` by walking the chain. The alternative — and the correct one — is that the *minting party* (A, or the AAIF exchange endpoint acting on A's behalf) must refuse to produce a child token whose scope is not provably a subset of the parent's, before the token exists. These are not equivalent. Enforcement-time subset checking is a *detection* control: it catches over-broad tokens only when and if a conforming resource server inspects them. Minting-time attenuation is a *prevention* control: an over-broad token never enters circulation, so a non-conforming or compromised resource server cannot honor it. The failure mode lives precisely in the gap between "the token was minted" and "a conforming verifier looked at it." ## What Was Observed In a multi-vendor AAIF deployment, agent A (an orchestrator) held a token scoped to `read:dataset/42` and `summarize:dataset/42`. A requested delegation to agent B for a subtask. The exchange endpoint minted a child token whose scope was computed by *union of requested scopes intersected with a cached parent-scope snapshot*. The cache had been populated from a parent token issued before a scope revocation event. The result: B received a child token containing `read:dataset/42`, `summarize:dataset/42`, and `export:dataset/42` — the last of which had been revoked from A's effective scope but persisted in the cache. Every AAIF-conformant resource server that walked the chain *should* have rejected the `export` scope. One did. A second resource server — a legacy adapter that validated signatures and expiry but treated the token's scope claim as authoritative without chain-walking — honored `export:dataset/42`. The over-broad capability was exercised for roughly fourteen minutes before audit reconciliation. The detection control worked exactly as designed on the conforming server and did nothing on the non-conforming one. The non-obvious element: the *subset relation itself* was never violated at mint time against the cached snapshot. The bug was that the snapshot was stale, so the subset check passed against a parent scope that no longer existed. Attenuation was being computed against a *believed* parent, not the *presented* parent token. ## Condition of Validity Minting-time attenuation is only sound under three simultaneous conditions, and the observed failure violated the second: 1. **Parent provenance.** The subset check must be evaluated against the parent token *as presented in this exchange request*, not against any cached, derived, or session-associated scope snapshot. The parent token's signed scope claim is the sole authority. 2. **Revocation freshness.** Any scope that has been revoked from the parent must be absent from the parent token presented at exchange time, or the exchange must consult a revocation oracle that is authoritative at the instant of minting. A cache with any TTL is not authoritative for attenuation. 3. **Closure under the scope algebra.** The subset relation must be decidable over the scope grammar in use. If scopes include wildcards, parameterized resources, or condition expressions (e.g., `read:dataset/*` or `read:dataset/42 if time < T`), subset checking requires a real solver over that algebra; string-prefix matching is unsound and will admit scope escalation through wildcard expansion. When any condition fails, the correct behavior is to refuse minting, not to fall back to enforcement-time checking. ## Decision Boundary Enforce at minting time, and treat the following as hard refusal conditions at the exchange endpoint: - The requested child scope is not provably a subset of the presented parent token's scope under the full scope algebra (not prefix matching). - The parent token cannot be resolved to a currently-valid signed grant (expired, revoked, or chain-broken). - The scope algebra contains constructs the endpoint cannot decide (unknown wildcard forms, unparseable conditions) — refuse rather than approximate. - The delegation depth exceeds the parent token's `max_delegation_depth` claim. Do **not** defer any of these to the relying party. The relying party remains a defense-in-depth verifier, but it is not the load-bearing control. The load-bearing control is that a non-subset token is never signed. ## Operational Effect After moving attenuation to the minting boundary and removing the scope cache, the deployment observed: (a) over-broad tokens dropped to zero in circulation, including against non-conforming resource servers; (b) a small increase in exchange-endpoint refusals during revocation propagation windows, which is the *correct* observable — refusals are cheap, leaked capabilities are not; (c) the legacy adapter that skipped chain-walking became non-exploitable for scope escalation because it could no longer receive an escalated token. The cost is latency at mint time (a signature verification and a subset decision per exchange) and the requirement that the scope algebra be decidable. Both are acceptable; the alternative is a detection control that silently depends on every downstream verifier being correct. ```python from dataclasses import dataclass from typing import FrozenSet class ScopeAttenuationError(RuntimeError): """Raised when a delegated child token would exceed its parent's scope.""" @dataclass(frozen=True) class CapabilityToken: subject: str scopes: FrozenSet[str] max_delegation_depth: int signature_valid: bool def mint_delegated_token( parent: CapabilityToken, child_subject: str, requested_scopes: FrozenSet[str], ) -> CapabilityToken: # Condition 1: parent provenance — use the presented token, never a cache. if not parent.signature_valid: raise ScopeAttenuationError( f"parent token for {parent.subject} has invalid signature; refusing to mint" ) # Condition 3: closure under scope algebra — we only support exact scope # atoms here. Wildcards/conditions must be decided by a real solver; if the # algebra is undecidable at this endpoint, refuse rather than approximate. for scope in requested_scopes: if "*" in scope or " if " in scope: raise ScopeAttenuationError( f"scope {scope!r} uses an algebra this endpoint cannot decide; refusing" ) # Condition 2: revocation freshness — the presented parent is authoritative, # so a revoked scope simply will not appear in parent.scopes. escalation = requested_scopes - parent.scopes if escalation: raise ScopeAttenuationError( f"requested scopes {sorted(escalation)} exceed parent scope " f"{sorted(parent.scopes)}; refusing to mint" ) if parent.max_delegation_depth <= 0: raise ScopeAttenuationError( f"delegation depth exhausted for {parent.subject}; refusing to mint" ) return CapabilityToken( subject=child_subject, scopes=requested_scopes, max_delegation_depth=parent.max_delegation_depth - 1, signature_valid=True, ) ```