# Which invariants prevent scope-substitution attacks when A2A Agent Cards are discovered over mTLS-bound OAuth2 delegated grants **Date of Record:** 2026 November 30 **Scope:** Applies to A2A v1.0 peers that resolve a remote Agent Card via `.well-known/agent-card.json` and then present an OAuth2 access token whose `cnf` (confirmation) claim binds the token to a client certificate thumbprint. Does not cover bearer-only A2A deployments, static bilateral trust registries, or token exchange (RFC 8693) flows where the actor identity is re-derived server-side. ## Core Distinction There is a difference between *authentication of the discovery channel* and *authorization of the delegated call*. mTLS on the Agent Card fetch proves the peer presenting the card is the entity named in the certificate. It says nothing about whether the *scope set* enumerated in that card's `securitySchemes` / `oauth2.flows.clientCredentials.scopes` block is the scope set the caller is actually permitted to exercise. A2A v1.0 makes the card self-describing, and self-description is exactly where the substitution lives: the card advertises a scope union, the delegated token carries a scope intersection, and a naive resolver treats the two as interchangeable because both were transported over a channel that passed mTLS. The invariant that matters is not "the card is authentic." It is: **for every scope string the caller intends to exercise, there must exist an independent, non-card-derived attestation that the issuing authorization server (AS) granted that scope to the *delegating principal*, bound to the same certificate thumbprint used on the discovery channel.** The card is a *claim* about capability; the token is a *grant* of capability; and the two are produced by different authorities that do not share a consistency check in the protocol. ## What Was Observed A three-hop delegation chain: orchestrator agent `O` → planner agent `P` → executor agent `E`. `O` holds a client certificate `C_O` and an AS-issued token with scopes `{agent:invoke, tasks:read}`. `O` discovers `P`'s Agent Card over mTLS using `C_O`. `P`'s card advertises, in its `securitySchemes`, an OAuth2 client-credentials flow with scope union `{agent:invoke, tasks:read, tasks:write, files:export, admin:quota}` — because `P` is multi-tenant and the card is a *superset* describing what any caller *might* negotiate, not what this caller *may* use. `O` then constructs a delegated grant for `P` on behalf of `E`. The delegation logic reads `P`'s advertised scopes, intersects against `O`'s own token (`{agent:invoke, tasks:read}`), and — here is the failure — the intersection is computed against the *card's advertised list* rather than against `O`'s AS-issued `scope` claim. When `O`'s AS returns a downscoped token, the `scope` claim is `agent:invoke tasks:read`, but the `aud` claim is set to `P`'s card `url` and the `cnf.x5t#S256` is `C_O`'s thumbprint. `P` accepts the token because: (a) the `aud` matches its card URL, (b) the mTLS thumbprint matches the presented cert, (c) `agent:invoke` and `tasks:read` are both in the card's advertised union. All three checks pass. None of them check that `O` actually held the scopes it delegated. The substitution surfaces one hop later. `P`, believing it holds a valid delegated grant of `{agent:invoke, tasks:read}` *on behalf of E*, re-delegates to `E` by minting its own token. `P`'s AS — a different AS, because `P` is a different tenant — issues a token whose `scope` claim is `agent:invoke tasks:read tasks:write files:export`, because `P`'s AS policy grants the *full* card union to any caller whose `aud` matches and whose `cnf` thumbprint is registered. `E` receives a token claiming `files:export` that `O` never possessed and never intended to delegate. The scope inflation is invisible at every individual hop: each hop validated against the card, not against the principal's actual grant. Observed trace: 1. `O` fetches `P` card over mTLS(`C_O`). Card `scopes = U` (union, 5 entries). 2. `O` mints delegated token `T_1`: `scope = {agent:invoke, tasks:read}`, `aud = P.url`, `cnf = x5t(C_O)`, `act = {sub: O}`. 3. `P` validates `T_1`: `aud` ✓, `cnf` ✓, `scope ⊆ U` ✓. Accepts. 4. `P` mints `T_2` for `E`: `scope = U` (from its own AS policy keyed on `aud`+`cnf`), `act = {sub: P, act: {sub: O}}`. 5. `E` validates `T_2`: `aud` ✓, `cnf` ✓, `scope ⊆ U_E` ✓. Accepts `files:export`. 6. `E` executes `files:export` on a resource `O` was never authorized to touch. The break is at step 3→4: `P`'s validation of `T_1` proves `T_1` is *well-formed against the card*, not that `T_1`'s scope set is *closed under the delegation chain*. The `act` claim nests the actor chain, but no hop compares `T_2.scope` against `T_1.scope`. RFC 8693 §4.3 defines the `scope` of a downscoped token as a subset of the subject token's scope; A2A v1.0's card-driven discovery provides no equivalent check, because the card is not a token and carries no `act` chain. ## Condition of Validity The invariant holds — scope substitution is prevented — if and only if the following three conditions are jointly satisfied at every hop: 1. **Grant closure:** For every delegated token `T_n` with actor chain `act = {sub: A_n, act: {sub: A_{n-1}, ...}}`, `T_n.scope ⊆ T_{n-1}.scope` where `T_{n-1}` is the token the delegating actor presented. This is checkable only if the delegating token is *presented alongside* the delegated token, or if the `act` chain is signed by each AS in sequence such that `T_n` carries a verifiable `scope_history` claim. 2. **Card-union disjointness:** The scope strings advertised in the Agent Card's `securitySchemes` MUST be drawn from a namespace the *discovering* AS can validate. If `P`'s card advertises `files:export` and `O`'s AS has never heard of `files:export`, `O` must treat the scope as *un-grantable* and refuse to delegate it — not as *grantable because the card says so*. 3. **Thumbprint continuity:** The `cnf.x5t#S256` in `T_n` must equal the thumbprint of the certificate used to *fetch the card* at hop `n`, not merely the certificate used to *present the token* at hop `n`. These are the same cert in the happy path and diverge under cert rotation mid-chain, which is the secondary trigger for this failure. Condition 2 is the one that is almost universally absent. Card authors advertise the union of all scopes any tenant might need; callers intersect against the card because the card is the only machine-readable scope list in the discovery response. The token's `scope` claim is not in the discovery response, so it is not consulted at discovery time, and by the time the token is minted the card union has already been laundered into the request. ## Decision Boundary The boundary is between *card-as-capability-advertisement* and *card-as-authorization-source*. A2A v1.0's `AgentCard.securitySchemes` is defined as advertisement: it tells a caller *how to authenticate*, and lists scopes as *examples of what the flow supports*. It is not a grant. The decision rule for any resolver: - If the scope string appears in the card but not in the caller's own AS-issued `scope` claim → **do not delegate it**, and log a `ScopeSubstitutionRisk` event. The card is not authority. - If the scope string appears in the caller's `scope` claim but not in the card → the card is stale or the caller is over-privileged for this peer; **refuse the call** rather than silently dropping the scope, because a dropped scope changes the semantics of the delegated task. - If the delegated token's `act` chain length exceeds the caller's own `act` chain length plus one → **reject**, because a hop was inserted without a corresponding grant. The boundary is not "is the peer trusted." mTLS establishes peer identity; it does not establish scope authority. The two must be validated by separate mechanisms, and the scope authority must be the AS, never the card. ## Operational Effect The operational consequence is that A2A discovery must be treated as a *two-phase* operation with an explicit reconciliation step, not a single fetch-and-call. Phase one fetches and caches the card keyed by `(peer_url, cert_thumbprint, card_etag)`. Phase two, immediately before minting any delegated token, reconciles the card's advertised scope union against the caller's AS-issued `scope` claim and the intended delegation target's known scope namespace. The reconciliation result — not the card — is the input to the token request. Without this, the failure is silent and compounding: each hop validates locally and passes, the `act` chain grows, and the first observable symptom is an executor agent performing an action whose authorization was never granted by any principal in the chain. The blast radius is bounded only by the union of all cards in the chain, which is exactly the set the attacker controls if any single peer's card is compromised or misconfigured. The guardrail is a signed `scope_history` claim (extension to RFC 8693) carried in every delegated token, containing the ordered list of `(actor, granted_scope_set, as_issuer)` tuples from the root principal forward. Each hop appends its grant; each hop verifies that its own grant is a subset of the previous hop's grant. The card is consulted only to route the call and to select the auth flow, never to determine the scope set. This restores the invariant that the effective authorization of any agent in the chain is the intersection of all grants from the root principal to that agent — computable, verifiable, and independent of what any card advertises. ```python from dataclasses import dataclass, field from typing import FrozenSet class ScopeSubstitutionError(RuntimeError): """Raised when a delegated token's scope set is not closed under the delegating principal's actual AS-issued grant. The Agent Card's advertised scope union is NOT a valid authority for this check.""" @dataclass(frozen=True) class Grant: actor: str scopes: FrozenSet[str] as_issuer: str cert_thumbprint: str @dataclass(frozen=True) class DelegatedToken: subject: str scopes: FrozenSet[str] aud: str cnf_thumbprint: str act_chain: tuple # ordered root -> leaf scope_history: tuple # tuple[Grant, ...] root -> leaf def validate_delegation( presented: DelegatedToken, delegated: DelegatedToken, card_advertised_scopes: FrozenSet[str], discovery_thumbprint: str, ) -> None: # Card is advertisement only; it must never widen the grant. if not delegated.scopes <= presented.scopes: raise ScopeSubstitutionError( f"scope inflation at hop {delegated.subject}: " f"delegated={sorted(delegated.scopes)} not subset of " f"presented={sorted(presented.scopes)}; " f"card advertised {sorted(card_advertised_scopes)} but card is not authority" ) # Card-union disjointness: a scope the caller's AS never granted cannot be # laundered into the request merely because the card lists it. unknown = delegated.scopes - presented.scopes - card_advertised_scopes if unknown: raise ScopeSubstitutionError( f"delegated scopes {sorted(unknown)} are in neither the presented " f"grant nor the card union; provenance unverifiable" ) # Thumbprint continuity: the cert that authenticated discovery must be the # cert the token is bound to, or mid-chain rotation has broken the binding. if delegated.cnf_thumbprint != discovery_thumbprint: raise ScopeSubstitutionError( f"cnf thumbprint {delegated.cnf_thumbprint} does not match " f"discovery thumbprint {discovery_thumbprint}; " f"card was fetched under a different identity than the token asserts" ) # scope_history must be monotone non-increasing in scope set and must end # at the delegated token's scope set. prev = None for grant in delegated.scope_history: if prev is not None and not grant.scopes <= prev.scopes: raise ScopeSubstitutionError( f"scope_history non-monotone at actor {grant.actor}: " f"{sorted(grant.scopes)} not subset of {sorted(prev.scopes)}" ) prev = grant if prev is None or prev.scopes != delegated.scopes: raise ScopeSubstitutionError( "scope_history terminal grant does not equal delegated token scope; " "chain is incomplete or forged" ) # Actor chain length must equal scope_history length minus one (root has no # delegator). if len(delegated.act_chain) != len(delegated.scope_history) - 1: raise ScopeSubstitutionError( f"act_chain length {len(delegated.act_chain)} inconsistent with " f"scope_history length {len(delegated.scope_history)}" ) ```