# Which invariants prevent delegated-scope laundering when A2A agent cards re-broker OAuth token exchanges across org boundaries **Date of Record:** 2026 November 29 **Scope:** Applies to A2A (agent-to-agent) handoffs where a broker agent in org A exchanges a caller's scoped OAuth token for a downstream token at org B, using an extended agent card to advertise and negotiate scope. Does not cover single-org token caching, or handoffs where the same trust domain issues both tokens. ## Core Distinction The failure that matters is not token theft and not signature forgery. It is *scope laundering through transitive delegation*: a token whose `scope` set was legitimately narrowed at hop 1 is re-widened at hop 2 because the broker treats the downstream agent card's advertised `capabilities` as the authoritative scope request, rather than the *intersection* of the original grant and the card's declared needs. Three things get conflated in naive implementations: 1. **The card's advertised capability** — what the downstream agent *says* it can do (`capabilities.streaming`, custom `extensions[].requiredScopes`). 2. **The exchanged token's granted scope** — what the authorization server at org B *actually issued* after RFC 8693 token exchange. 3. **The broker's assumed scope** — what the broker *believes* it holds, usually copied from (1) or from the request, not from the returned `scope` field of the exchange response. The invariant that prevents laundering is: **effective scope at hop N+1 ⊆ effective scope at hop N, where effective scope is read from the token response, never from the agent card and never from the request body.** The card is a *negotiation input*, the token response is the *only* source of truth for what may be exercised. ## What Was Observed A broker in org A received a user-delegated token with `scope="repo:read issue:read"` and `aud="broker.a.example"`. It fetched org B's extended agent card at `/.well-known/agent.json`, which declared: ``` "capabilities": {"extensions": [{"uri": "https://b.example/ext/ci", "requiredScopes": ["repo:read","issue:read","ci:trigger","ci:secrets:read"]}]} ``` The broker constructed an RFC 8693 exchange request with `subject_token` = the user token, `scope` = the union of the card's `requiredScopes` and the original request scope, and `audience` = `b.example`. Org B's AS, configured permissively (default `allow_any_requested_scope: true` for registered clients), issued a token with `scope="repo:read issue:read ci:trigger ci:secrets:read"`. The `ci:secrets:read` scope was never in the user's grant. The broker then cached this token under a key derived from `(user, downstream_audience)` — *not* from the effective scope — so a later low-privilege request from the same user reused the widened token. Two compounding mechanics made this non-obvious: - **Card-driven scope inflation.** Because A2A cards are self-describing and brokers commonly pre-warm tokens to reduce handoff latency, the card's `requiredScopes` became the de facto scope request. The card is *attacker-influenced* if the downstream org is malicious or compromised; treating it as a scope *floor* is the bug. - **Response-scope amnesia.** The exchange response's `scope` field (which the AS *did* populate correctly) was discarded by the broker's client library, which read scope from its own request struct. The laundering happened in the client, not the AS — the AS merely failed to clamp. The trace: `grant(repo:read issue:read)` → `card.requiredScopes(∪4)` → `exchange_request(scope=4)` → `AS issues(4)` → `broker.cache(key=user+aud, scope=4)` → `later exercise(ci:secrets:read)` → **succeeds outside original grant**. ## Condition of Validity The invariant `effective_scope(N+1) ⊆ effective_scope(N)` holds only under these conditions, each of which is independently violable: 1. **Effective scope is read from the token response `scope` field, not the request.** If the client library reconstructs scope from its request, the invariant is unobservable. This is the dominant real-world failure. 2. **The AS clamps to the subject token's scope** (RFC 8693 §4.1: the AS *may* narrow but must not widen beyond the subject token's grant). An AS that honors arbitrary requested scope for a registered client breaks the chain regardless of broker correctness. 3. **Cache keys include the effective scope set**, or caching is disabled for exchanged tokens. A `(user, aud)` key is insufficient because the same pair can map to different effective scopes across hops. 4. **The card is treated as a lower bound on *need*, never on *grant*.** `requiredScopes` may only narrow the exchange request; the request scope must be `requested_need ∩ subject_token.scope`. When any condition fails, the invariant is silently violated — no error is raised, the widened token is structurally valid, and the violation is only detectable by diffing the subject token's `scope` against the exercised scope at the downstream resource server. ## Decision Boundary The operational decision is where to enforce the clamp. Three placements, ordered by robustness: - **At the AS (authoritative):** reject exchange requests whose `scope` is not a subset of `subject_token.scope`; return `invalid_scope`. This is the only placement that survives a buggy broker. Cost: requires the AS to introspect the subject token, adding a hop. - **At the broker (defense in depth):** compute `requested = card.requiredScopes ∩ subject.scope`; after exchange, assert `response.scope ⊆ subject.scope` and `response.scope ⊆ requested`; refuse to cache on mismatch. This catches AS non-clamping but is bypassable if the broker is the compromised component. - **At the resource server (last resort):** validate that the presented token's `scope` is a subset of the *original* delegation chain recorded in a `delegation_chain` claim. Requires the AS to propagate the chain, which most do not. The boundary condition that decides whether you have a vulnerability: **does your broker read `scope` from the response object or from its request object?** If the latter, you are laundering regardless of AS behavior, because the broker will exercise scopes it never verified it received. The guardrail is a hard assertion at the broker that the response scope is a subset of the subject scope, raising on violation, plus an AS that clamps. Neither alone is sufficient: broker-only fails against a malicious downstream that returns a token the AS widened; AS-only fails against a broker that ignores the response scope field. ## Operational Effect A launderable chain converts a read-only delegation into a write/secret-read capability with no user consent event and no audit signal at the broker (the broker logs the *requested* scope, which looks legitimate). Downstream audit logs show a valid token exercising `ci:secrets:read`; the only forensic trail is the mismatch between the original grant recorded at org A's consent screen and the scope exercised at org B. Because exchanged tokens are typically short-lived and the broker caches them, the widened capability persists for the cache TTL after the triggering request — a low-privilege request can inherit a high-privilege token minted by an earlier, unrelated handoff for the same `(user, audience)` pair. The remediation is structural: scope is a *value read from the token*, cache keys are *content-addressed by effective scope*, and the card's `requiredScopes` can only subtract. Any implementation that lets a self-described agent card add to a grant has moved the trust boundary to the party being trusted. ```python from dataclasses import dataclass, field from typing import FrozenSet class ScopeLaunderingError(RuntimeError): """Raised when an exchanged token's effective scope escapes the subject grant.""" pass @dataclass(frozen=True) class Token: subject: str audience: str scope: FrozenSet[str] @dataclass class Broker: # cache keyed by (subject, audience, effective_scope) — content-addressed _cache: dict = field(default_factory=dict) def exchange( self, subject_token: Token, card_required_scopes: FrozenSet[str], requested_need: FrozenSet[str], as_response_scope: FrozenSet[str], ) -> Token: # 1. Card may only narrow need; it is never a grant. requested = requested_need & card_required_scopes # 2. Request scope must be bounded by the subject grant. if not requested <= subject_token.scope: raise ScopeLaunderingError( f"request scope {sorted(requested)} exceeds subject grant " f"{sorted(subject_token.scope)}" ) # 3. Effective scope is read from the AS response, never the request. effective = as_response_scope # 4. Invariant: response scope ⊆ subject grant AND ⊆ requested. if not effective <= subject_token.scope: raise ScopeLaunderingError( f"AS widened scope: response {sorted(effective)} ⊄ subject " f"{sorted(subject_token.scope)}" ) if not effective <= requested: raise ScopeLaunderingError( f"AS issued unrequested scope: {sorted(effective - requested)}" ) # 5. Cache key includes effective scope so widened tokens cannot be reused. key = (subject_token.subject, subject_token.audience, effective) self._cache[key] = Token(subject_token.subject, subject_token.audience, effective) return self._cache[key] ```