# Where must an instance bind the OAuth subject to the A2A capability warrant before token exchange, or the handoff silently impersonates the caller **Date of Record:** 2026 November 24 **Scope:** Applies to A2A handshakes where a receiving agent (callee) authenticates an inbound caller by exchanging an OAuth token (RFC 8693 token exchange or client-credentials) and then maps the resulting access token to an internal capability warrant. Does not cover plain bearer-token passthrough with no exchange step, nor machine-to-machine mTLS-only trust where no OAuth subject exists. ## Core Distinction There are two distinct identities in an A2A handshake, and they are conflated at exactly one place: the **OAuth subject** (`sub` of the inbound assertion — who the human or upstream service is) and the **agent principal** (`client_id` / actor of the exchanging instance — which agent is acting). Token exchange profiles let a callee *downscope and re-issue* a token so the acting agent can call a downstream tool "on behalf of" the subject. The failure is not that the exchange fails; it is that the exchange succeeds and the callee binds the **warrant** (its internal grant of capabilities) to the wrong half of the pair. When the warrant is keyed on the exchanged token's `client_id` (the agent) instead of the `act`/`sub` claim chain (the delegating subject), every subsequent tool call in that task inherits the agent's full capability set rather than the subject's scoped set. The handshake looks clean, the token validates, and the agent quietly impersonates the caller for the remainder of the task. ## What Was Observed An orchestrator agent `A` receives a user request, obtains a user-delegated token with `sub=user:U`, `scope=tasks:read tasks:write`, and `act={sub: agent:A}`. It hands off to worker agent `B` over A2A, passing the delegated token in the handshake. `B` performs RFC 8693 token exchange against the authorization server, requesting a token for the downstream resource `R`. The AS returns an exchanged token whose `sub` is still `user:U` but whose `client_id` is `B` and whose `act` claim now reads `{sub: agent:A, act: {sub: agent:B}}` — a two-hop delegation chain. `B`'s warrant resolver reads the token, finds `client_id=B`, looks up `B`'s registered capability manifest, and issues a warrant granting `B` everything in its manifest: `tasks:read tasks:write admin:audit`. The `admin:audit` scope was never in `user:U`'s delegated scope. It was in `B`'s static manifest. The resolver never compared the exchanged token's effective scope against the inbound assertion's scope, and never walked the `act` chain to confirm `B` was acting under `A`'s and `U`'s authority rather than its own. The observable signature is subtle: the task completes, downstream calls to `R` succeed, and the only anomaly is in `R`'s audit log — a `admin:audit` read attributed to `user:U` that `U` never authorized. The impersonation is *latent*: it does not fail the handshake, it corrupts the authority record for every tool call in the task's lifetime. ## Condition of Validity The invariant that must hold: **the warrant issued at handoff must be the intersection of (a) the inbound assertion's effective scope and (b) the callee's manifest, keyed to the delegation chain, never the union and never the callee's manifest alone.** This holds only when all three of the following are enforced at the exchange boundary: 1. **Scope intersection, not substitution.** After exchange, compute `effective = inbound_scope ∩ callee_manifest_scopes`. If `effective` is empty for a requested capability, the handshake must fail closed, not fall back to the callee's manifest. 2. **Delegation-chain preservation.** The exchanged token's `act` chain must be a strict extension of the inbound `act` chain (each hop appended, none rewritten). A callee that receives `act={sub: agent:A}` and emits `act={sub: agent:B}` (dropping `A`) has severed the chain and the warrant must be rejected. 3. **Subject immutability.** `sub` must be byte-identical across exchange. An AS that re-issues with a service-account `sub` (common in client-credentials exchange profiles) breaks the binding and the callee must detect the substitution. The condition fails the moment the resolver treats "token validated" as "warrant authorized." Validation proves the token is authentic; it says nothing about whether the *capability set* matches the delegation. ## Decision Boundary The boundary is between **token validation** and **warrant derivation**. These are separate gates and must not share a code path that short-circuits. - *Below the boundary (validation):* signature, expiry, issuer, audience, `act` chain well-formedness. A failure here rejects the handshake outright. - *Above the boundary (warrant derivation):* scope intersection, chain-extension check, subject-identity check. A failure here must **downgrade the warrant**, not reject the handshake — because a valid token with an over-broad manifest is a legitimate exchange that must be *scoped down*, whereas an invalid token is a *rejected* exchange. Conflating the two produces the observed bug: the resolver validates (passes), then derives the warrant from the manifest (over-broad), and because derivation never had a failure branch, nothing catches the mismatch. The decision boundary must be explicit: derivation returns either a scoped warrant or a `WarrantScopeViolation`, and the handoff handler must treat the latter as a hard stop before any tool call is dispatched. ## Operational Effect Downstream, the effect is **authority laundering**. Every tool call `B` makes on behalf of the task carries `user:U` as `sub` but `B`'s manifest scopes as effective authority. The audit trail attributes `B`'s privileged actions to `U`. When `U` later reviews their access log, they see reads they never made; when an incident responder traces a data access, the `act` chain shows `A→B` but the scope shows `admin:audit`, which neither `A` nor `U` possessed. The chain and the scope disagree, and without the intersection check there is no artifact that records the disagreement at the moment it occurred — only the corrupted downstream log. The guardrail is to make the intersection a *typed* operation that cannot return a silent superset, and to emit a `WarrantScopeViolation` at derivation time so the handoff fails before the first tool call, not after the task's audit record is already poisoned. ```python from dataclasses import dataclass class WarrantScopeViolation(RuntimeError): """Raised when an exchanged token's derived warrant exceeds the delegating subject's authority.""" @dataclass(frozen=True) class Claim: sub: str client_id: str scopes: frozenset[str] act_chain: tuple[str, ...] # outermost delegator first, e.g. ("agent:A", "agent:B") def derive_warrant(inbound: Claim, exchanged: Claim, callee_manifest: frozenset[str]) -> frozenset[str]: # Invariant 3: subject immutability across exchange. if exchanged.sub != inbound.sub: raise WarrantScopeViolation( f"subject substituted during exchange: inbound sub={inbound.sub!r} " f"exchanged sub={exchanged.sub!r}; cannot bind warrant to a different principal" ) # Invariant 2: delegation chain must be a strict extension, not a rewrite. if exchanged.act_chain[: len(inbound.act_chain)] != inbound.act_chain: raise WarrantScopeViolation( f"delegation chain severed: inbound act={inbound.act_chain} " f"exchanged act={exchanged.act_chain}; callee dropped a delegator" ) # Invariant 1: effective scope is the intersection, never the manifest alone. effective = inbound.scopes & exchanged.scopes & callee_manifest if not effective: raise WarrantScopeViolation( f"empty warrant: inbound={sorted(inbound.scopes)} exchanged={sorted(exchanged.scopes)} " f"manifest={sorted(callee_manifest)}; refusing to fall back to callee manifest" ) # Explicit superset check: the exchanged token must not carry scopes the # delegating subject never held. This is the exact condition that produced # the admin:audit laundering in the observed incident. over_broad = exchanged.scopes - inbound.scopes if over_broad: raise WarrantScopeViolation( f"exchanged token exceeds delegating scope: {sorted(over_broad)} " f"not present in inbound scopes {sorted(inbound.scopes)}" ) return effective def handle_handoff(inbound: Claim, exchanged: Claim, callee_manifest: frozenset[str]) -> frozenset[str]: try: return derive_warrant(inbound, exchanged, callee_manifest) except WarrantScopeViolation: # Fail closed before any tool call is dispatched; do not downgrade silently. raise ```