# Why does an instance lose scope attenuation when an A2A task crosses an OAuth 2.1 token-exchange boundary? **Date of Record:** 2026 November 28 **Scope:** Applies to agent-to-agent (A2A) delegation where the receiving agent authenticates to downstream resources using a token obtained via OAuth 2.1 token exchange (RFC 8693) with `scope` attenuation, and where the A2A task object carries its own authorization context. Does not apply to single-org delegation where the token issuer and the A2A endpoint share a trust root, nor to pure bearer-token passthrough with no exchange step. ## Core Distinction The failure is not "the token was rejected." It is that the token was *accepted* while carrying a scope set that is a strict superset of what the delegating agent intended to grant. The delegating orchestrator believes it attenuated `[read:invoices, write:invoices]` down to `[read:invoices]`. The resource server downstream of the second organization sees a token whose `scope` claim is `read:invoices write:invoices` because the exchange step re-derived scope from the *subject token's* granted scope rather than from the `scope` parameter the A2A task actually requested. The attenuation was silently widened, not narrowed, and no error surfaced at any hop. The non-obvious part: RFC 8693 §2.1 says a `scope` parameter in the token-exchange request is a *request*, and the authorization server MAY return a different scope. In cross-org A2A, the AS on the receiving side is often a different vendor's product than the one on the delegating side. Two conformant implementations disagree about whether "requested scope" is an upper bound (intersect with subject token) or a lower bound (union with subject token). The agent that treats it as a bound and the AS that treats it as a hint produce a scope-widening that passes every signature and audience check. ## What Was Observed A delegating agent `A` in org-1 holds a user-delegated token `T_u` with scope `invoices:read invoices:write customers:read`. It spawns an A2A task to agent `B` in org-2 asking B to reconcile a single invoice. `A` correctly constructs the exchange request: ``` grant_type=urn:ietf:params:oauth:grant-type:token-exchange subject_token=T_u subject_token_type=urn:ietf:params:oauth:token-type:access_token requested_token_type=urn:ietf:params:oauth:token-type:access_token scope=invoices:read audience=https://b.org-2.example ``` `B`'s AS returns `T_b` with `scope=invoices:read invoices:write customers:read` — the entire subject scope, because that AS's policy is "preserve subject scope unless the client is registered as a scope-restricting client." `B` does not re-check. `B` embeds `T_b` into its A2A task state and later forwards it to a resource server `R` in org-2. `R` sees `invoices:write` and `customers:read` on a token minted for a task that only asked to read one invoice. Three observable signatures distinguish this from a normal mint: 1. The `scope` claim of `T_b` is a superset of the `scope` parameter in the exchange request (visible only if the delegating side logs the request and the receiving side logs the response — which usually requires cross-org log correlation that does not exist by default). 2. `T_b.act.sub` (the actor claim) identifies `B`, but `T_b.sub` still resolves to the original user, so `R`'s audit log attributes the write to the human, not to the agent. 3. The A2A task object's own `authorization` metadata (if the task schema carries one) says `invoices:read`, while the token says otherwise. The task object and the token are two sources of truth that have silently diverged. ## Condition of Validity The invariant that must hold for safe cross-org A2A delegation is: > `scope(T_b) ⊆ scope(T_u) ∩ scope(requested)` — the minted token's scope is a subset of both the subject token's granted scope and the scope explicitly requested for the task, and this subset relation is *verified by the receiving agent* before the token is used, not assumed from the AS's behavior. The failure occurs precisely when the receiving agent treats the AS as the sole enforcement point. This is valid only when the AS is known to implement intersection semantics *and* the receiving agent can verify it. In cross-org delegation neither condition holds by default: the AS is operated by a different party with different policy, and the receiving agent has no way to read the AS's policy document at runtime. The condition of validity for *relying on the AS* is therefore: same trust domain, or a pre-negotiated client registration on the receiving AS that pins `scope` to intersection semantics for this client ID. Absent that, the receiving agent must enforce the subset check itself. The check is cheap — a set comparison on two claims — and it is the only thing standing between a task-scoped delegation and a full-privilege token leak into a downstream resource server. ## Decision Boundary The boundary is between two policies for handling a superset response: - **Fail-closed (correct for cross-org):** if `scope(T_b) ⊄ scope(requested)`, the receiving agent must refuse to use `T_b`, abort the A2A task with a `ScopeAttenuationViolation`, and (optionally) re-request with an explicit `client_id` registered for restriction. This is the only safe default when the AS is operated by another org. - **Fail-open (only valid same-org):** accept `T_b` and rely on downstream resource servers to enforce their own scope checks. Valid only when the AS and the receiving agent share a trust root and the AS's intersection semantics are contractually guaranteed. The decision must be made on the *response*, not the *request*. The delegating agent cannot enforce this — it does not see `T_b`. The receiving agent is the only party positioned to compare `scope(T_b)` against `scope(requested)`, and it must do so before the token is stored in task state or forwarded. A common inversion: teams put the check in the delegating agent's pre-flight (verifying `T_u` has the needed scope) and skip the post-exchange check. That catches the wrong failure — it catches under-privilege, not over-privilege. A second boundary: the `act` claim. If `T_b` lacks an `act` claim naming `B`, the token is a direct user token, not a delegated one, and every downstream write is attributable to the human. The receiving agent must reject tokens without `act.sub == B` for any task it acts on, regardless of scope. This is the identity half of the same invariant. ## Operational Effect When the invariant is enforced, the effect is a hard stop at the exchange boundary: the A2A task fails fast with a typed error, the delegating agent receives a structured failure (not a timeout), and no token with widened scope ever reaches a downstream resource server. The blast radius is one task. When it is not enforced, the effect is a silent privilege escalation that is invisible to every party except a cross-org log join that nobody performs. The receiving agent's task state now contains a token whose scope exceeds the task's declared authorization; any subsequent tool call the agent makes with that token inherits the excess. If the agent is itself compromised by prompt injection mid-task, the injected instruction can invoke `invoices:write` on a task that was scoped to read — and the audit trail attributes it to the original user via `sub`, with `act.sub` buried in a claim most log pipelines drop. The escalation is not detectable from either org's logs alone; it requires correlating the exchange request scope with the minted token scope across the org boundary. The remediation is structural: the receiving agent must treat `scope(requested)` as the authoritative bound, verify `scope(T_b) ⊆ scope(requested)` and `act.sub == B` at token receipt, and fail closed otherwise. The AS's behavior is not a trusted input in cross-org delegation. ```python class ScopeAttenuationViolation(RuntimeError): """Raised when a token-exchange response widens scope beyond the requested bound.""" pass class IdentityAttributionViolation(RuntimeError): """Raised when a delegated token lacks an act claim naming the receiving agent.""" pass def validate_delegated_token( token_claims: dict, requested_scope: set[str], expected_actor: str, ) -> None: granted = set(token_claims.get("scope", "").split()) # Invariant 1: minted scope must be a subset of the scope requested for the task. excess = granted - requested_scope if excess: raise ScopeAttenuationViolation( f"token scope {sorted(granted)} exceeds requested {sorted(requested_scope)}; " f"excess={sorted(excess)} aud={token_claims.get('aud')}" ) # Invariant 2: delegated tokens must name the acting agent in the act claim. act = token_claims.get("act") or {} if act.get("sub") != expected_actor: raise IdentityAttributionViolation( f"act.sub={act.get('sub')!r} != expected actor {expected_actor!r}; " f"token is not a valid delegation for this agent" ) def receive_exchange_response( response: dict, requested_scope: set[str], expected_actor: str, ) -> dict: claims = response.get("access_token_claims") if claims is None: raise ScopeAttenuationViolation( "exchange response did not include introspectable claims; " "cannot verify attenuation, refusing to proceed" ) validate_delegated_token(claims, requested_scope, expected_actor) return response ```