When must an instance refuse a scoped OAuth token exchange it cannot verify end-to-end

**Date of Record:** 2026 December 2 **Scope:** Applies to agent-to-agent (A2A) calls where the calling instance (the *actor*) exchanges a subject-scoped OAuth token for a downstream-scoped token via a token exchange endpoint (RFC 8693 semantics) and then presents that token to a peer agent (the *resource*). Does not apply to single-hop calls where the actor is also the resource, nor to long-lived API keys with no scope narrowing.

Core Distinction

The distinction that breaks operators is between **scope validity** and **scope verifiability**. A token exchange can succeed — signature valid, audience correct, `exp` in the future, `scope` claim present and syntactically well-formed — while the actor has no way to confirm that the *granted* scope is a subset of what the *original* subject actually authorized for this delegation chain. OAuth 2.0 token exchange (RFC 8693) returns an `access_token` and, critically, a `scope` field that the authorization server (AS) *chooses*. The AS is permitted to downscope, but nothing in the protocol forces it to prove the granted scope was derived from the presented `subject_token` rather than from a broader policy attached to the actor's own client credentials.

This matters because the actor is the one who will later be blamed, and cryptographically bound, when the resource agent acts on the exchanged token. If the granted scope exceeds the subject's original authorization, the actor has laundered privilege: it presented a narrow subject token and received a broad downstream token, and the resource has no way to tell the difference because it only sees the downstream token.

What Was Observed

A three-tier chain: a user delegated `repo:read` to an orchestrator agent (subject token, `sub=user:42`, `scope=repo:read`). The orchestrator exchanged this via `grant_type=urn:ietf:params:oauth:grant-type:token-exchange` at the AS, presenting `subject_token=<user token>` and `actor_token=<orchestrator client assertion>`, requesting `scope=repo:read repo:write`. The AS returned HTTP 200 with `access_token` carrying `scope="repo:read repo:write"` and `act={"sub":"orchestrator"}`.

The orchestrator then called a code-reviewer agent, which called a merge agent. The merge agent saw a token with `repo:write`, an `act` chain of `orchestrator -> reviewer`, and a `sub` of `user:42`. Every signature checked out. The merge happened. The user had never granted `repo:write`.

The failure was not a forgery. It was that the AS's policy engine resolved the requested scope against the **actor's** entitlements (the orchestrator's own service principal had `repo:write`), not against the **subject's** delegated grant. RFC 8693 §2.1 says the AS "MAY" issue a token with a scope different from the request, and says nothing that requires the granted scope be bounded by the subject token's scope. The orchestrator, correctly implementing the exchange, had no signal that the AS had widened rather than narrowed.

The second observation: the actor had no independent record of the subject token's scope at exchange time. It had the raw token but did not introspect it before exchange, so it could not compare `requested ⊆ original`. It trusted the AS to enforce the subset relation, and the AS did not.

Condition of Validity

A scoped exchange is only *safe to propagate* when the actor can establish, before presenting the downstream token to any resource, that the invariant

granted_scope ⊆ subject_token_scope ∩ requested_scope

holds as a fact the actor has verified, not as a fact the actor has assumed about the AS. This requires the actor to hold a trustworthy, unexpired reading of the subject token's scope — either by introspecting it (RFC 7662) at exchange time, or by having received it in a signed delegation assertion whose `scope` claim the actor validated. If the actor cannot obtain that reading — introspection endpoint unreachable, subject token opaque, or the AS returns a `scope` field the actor cannot corroborate — the subset relation is unverified, and the exchange must be treated as having granted *the entire actor entitlement*, not the requested scope.

There is a second condition: the `act` claim must be present and must name the actor. If the AS omits `act`, the downstream resource cannot attribute the action, and the delegation chain is broken even if scope is correct. A token with correct scope but no `act` is a token that will be attributed to the subject directly, which misrepresents who acted.

Decision Boundary

The boundary is: **the actor may proceed only if it has independently corroborated the granted scope against the subject token's scope, and the corroboration must fail closed.** Concretely:

The asymmetry that makes this a boundary and not a preference: a false refusal costs a retry and a logged incident; a false proceed costs an unauthorized action attributed to a user who never granted it, with a valid cryptographic trail that makes it look intentional.

Operational Effect

When the invariant is enforced, the observable behavior changes in three places. First, exchange latency increases by one introspection round-trip per uncached `jti`; this is the price of verifiability and it is bounded by caching keyed on `jti`. Second, the actor gains a durable audit record — the corroborated `(subject_scope, requested_scope, granted_scope, act)` tuple — which is exactly what a post-incident replay needs and what the AS logs alone do not provide, because the AS logs the exchange but not the actor's decision to propagate. Third, and most importantly, privilege-widening AS behavior becomes *visible at the actor* rather than silently laundered to the resource. The failure mode moves from "unauthorized merge with a clean token" to "orchestrator refused exchange, incident opened, AS policy reviewed" — a strictly better failure.

The guardrail is not optional hardening. It is the only point in the chain where the subset relation between subject grant and downstream grant can be checked by a party that holds both facts. The resource holds only the downstream token; the AS holds only its own policy; the subject is not in the loop. The actor is the sole verifier, and if it does not verify, no one does.

import time
from dataclasses import dataclass
from typing import Optional


class UnverifiableExchangeError(RuntimeError):
    """Raised when a scoped token exchange cannot be corroborated end-to-end."""


@dataclass(frozen=True)
class TokenView:
    jti: str
    subject: str
    scope: frozenset
    act: Optional[str]
    exp: float


def _scope_set(raw: str) -> frozenset:
    return frozenset(s for s in raw.split() if s)


def corroborate_and_propagate(
    subject_token: TokenView,
    granted_token: TokenView,
    requested_scope: str,
    introspect,
    now: Optional[float] = None,
) -> TokenView:
    """
    Verify granted_scope subset of (subject_scope intersect requested_scope)
    before allowing the granted token to be presented to a resource agent.
    Fails closed on any inability to corroborate.
    """
    now = time.time() if now is None else now

    if granted_token.exp <= now:
        raise UnverifiableExchangeError(
            f"granted token {granted_token.jti} already expired at {granted_token.exp}"
        )

    if granted_token.act is None:
        raise UnverifiableExchangeError(
            f"granted token {granted_token.jti} missing act claim; "
            "delegation chain unattributable"
        )

    # Independent reading of the subject token's scope. No trust in the AS here.
    try:
        live_subject = introspect(subject_token.jti)
    except Exception as exc:
        raise UnverifiableExchangeError(
            f"introspection of subject token {subject_token.jti} failed: {exc!r}; "
            "granted scope is unverified and must not be propagated"
        ) from exc

    if live_subject is None or live_subject.scope != subject_token.scope:
        raise UnverifiableExchangeError(
            f"subject token {subject_token.jti} scope drifted or unreadable; "
            "cannot establish subset relation"
        )

    requested = _scope_set(requested_scope)
    permitted = live_subject.scope & requested

    if not granted_token.scope <= permitted:
        widened = granted_token.scope - permitted
        raise UnverifiableExchangeError(
            f"granted scope exceeds subject-authorized scope for jti "
            f"{granted_token.jti}; widened by {sorted(widened)}"
        )

    return granted_token