# Which invariants prevent silent capability widening when an MCP→A2A gateway re-derives tool schemas across heterogeneous auth scopes **Date of Record:** 2026 November 29 **Scope:** Applies to stateless protocol gateways that translate MCP `tools/list` + `tools/call` into A2A `message/send` tasks (and vice versa) while fronting legacy REST/SOAP endpoints behind a unified auth-and-rate layer. Does not apply to single-protocol servers, in-process tool routers, or gateways that pass an opaque, pre-negotiated capability blob end-to-end without re-derivation. ## Core Distinction The dangerous failure is not a translation *error* — a hard 4xx, a schema mismatch, a rejected call. Those are loud. The dangerous failure is a **translation that succeeds while widening capability**: the gateway emits a downstream call that the caller was never authorized to make, but which is *schema-valid* and *rate-legal*, so nothing in the pipeline raises. The distinction is between **capability preservation** (the downstream action is a subset of what the upstream caller's warrant permits) and **capability re-derivation** (the gateway reconstructs the downstream request from the *tool description* rather than from the *caller's warrant*). Widening lives entirely in the gap between those two. Concretely: an MCP client sees `search_documents(query: str, limit: int)`. The gateway maps this to an A2A task whose agent card advertises `search_documents(query, limit, scope, include_archived, tenant_override)`. The two extra parameters are not in the caller's schema. If the gateway fills them from *defaults* it is safe; if it fills them from *ambient gateway state* (the gateway's own service principal, its cached tenant context, its elevated rate class) it has silently granted the caller the gateway's authority. The call succeeds. The audit log shows a successful `search_documents`. The capability boundary has moved and no invariant fired. ## What Was Observed A gateway fronting three tool backends (an MCP-native vector store, an A2A document agent, a legacy SOAP archive) unified auth behind a single OIDC service token and a token-bucket rate governor keyed on `(caller_subject, tool_name)`. Under load, three distinct widening traces appeared: 1. **Scope defaulting under schema divergence.** The MCP schema exposed no `scope` field; the A2A agent card required `scope` as a non-optional string. The gateway's adapter filled `scope="*"` as a "safe default." Every MCP-originated call to the A2A agent therefore ran with wildcard scope. The schema was *satisfied*; the warrant was *exceeded*. The trigger is the mandatory-parameter asymmetry between the two protocol schemas plus a default chosen for liveness rather than least-privilege. 2. **Rate-class laundering via principal substitution.** The rate governor keyed buckets on the *downstream* principal (the gateway's service identity) for legacy SOAP calls, because the SOAP layer could not carry the caller's subject. All callers shared one bucket. A single high-volume agent exhausted the bucket, and the governor — seeing one principal — then *throttled every other caller* and, worse, when it fell back to "burst allowance," it admitted calls under the service principal's elevated class. The caller's rate warrant was replaced by the gateway's. Trigger: any backend that cannot propagate caller identity forces the governor to key on a proxy identity. 3. **Capability leakage across a warm adapter cache.** The gateway cached A2A agent cards for 300s. A card refresh that *removed* a tool parameter (tightening the contract) was not observed until expiry; meanwhile the adapter kept emitting the old, wider parameter set. Calls were valid against the stale card, invalid against the live one. The window is bounded by cache TTL but the widening is real for its duration. In all three, the caller's request was well-formed, the downstream response was 2xx, and no exception path executed. The failure is invisible to per-call validation because per-call validation checks the call against *a* schema — just not the caller's schema. ## Condition of Validity The invariant that must hold is **warrant-subset preservation across every derivation step**: for every downstream call `d` produced from upstream call `u`, `authority(d) ⊆ authority(u)`, where `authority` is the tuple `(subject, scope_set, rate_class, tenant, parameter_domain)`. This invariant is *only* checkable if the gateway retains the upstream warrant as a first-class object through the entire translation — not as a set of ambient defaults, not as the service principal, not as a cached card. The invariant is valid (and the gateway is safe) only when all of the following hold: - **No default may exceed the caller's domain.** Any parameter the gateway must synthesize because the source schema omitted it must be drawn from the caller's warrant or set to the *most restrictive* legal value, never to a liveness default. `scope="*"` is a violation by construction. - **The rate governor keys on the caller subject, or the gateway refuses to govern.** If a backend cannot carry caller identity, the gateway must either propagate it out-of-band (header, signed claim) or reject the call as ungovernable. Falling back to the service principal silently converts per-caller rate governance into shared-bucket governance and launders rate class. - **Adapter cards are validated against the caller's mandate at call time, not cache time.** A cached card is a *hint*; the authoritative schema for the call is the one resolved at emission, and any parameter present in the cached card but absent from the caller's warrant is a widening candidate. - **Schema satisfaction is necessary but not sufficient.** A call that validates against the downstream schema and passes the rate check has proven nothing about capability. The subset check must be a separate, explicit gate. When any of these is false, the gateway is in a state where widening is *possible and undetectable* — the call succeeds, the log is clean, and the boundary has moved. ## Decision Boundary The gateway must make an explicit, per-call decision at the emission boundary, and the decision must be one of exactly three outcomes — never a silent fourth: - **Pass**: `authority(d) ⊆ authority(u)` verified against the caller's warrant object; downstream call emitted with the caller's subject attached (or a signed derivation of it). - **Constrain**: the source schema omitted parameters the target requires; the gateway fills them from the caller's warrant (narrowing) and records the synthesis in the call's provenance envelope. If narrowing is impossible (the target requires a value the caller cannot supply), fall through to Reject. - **Reject**: any parameter in `d` cannot be bounded by `authority(u)`; any backend that cannot receive caller identity; any card whose live schema conflicts with the cached schema in a widening direction. Rejection must be a typed error, not a downgrade to a default. The boundary is the point where the gateway is tempted to choose a *fourth* outcome — "emit anyway because the schema is happy and the rate bucket has room." That fourth outcome is the entire failure class. The guardrail is that the subset check is a hard gate with no bypass flag, and that synthesized parameters are tagged so downstream auditors can distinguish caller-supplied from gateway-supplied values. A second boundary: **cache TTL vs. contract tightening.** When a live card is *narrower* than the cached card, the gateway must treat the cached card as invalid immediately (fail-closed on tightening) rather than waiting for expiry. Widening from a stale cache is the only direction that matters; narrowing from a stale cache merely causes spurious rejections, which are safe. ## Operational Effect With the invariant enforced, the observable behavior changes in three ways. First, MCP-originated calls to the A2A agent that previously ran under `scope="*"` now either carry the caller's actual scope or are rejected with `WarrantSubsetViolation` — the vector store's result set shrinks to the caller's authorized partition, which is the *correct* result and which previously looked like a recall regression to anyone reading dashboards. Second, legacy SOAP calls now either propagate caller identity out-of-band or are refused as ungovernable; the shared rate bucket disappears and per-caller throttling becomes meaningful, at the cost that callers previously "helped" by the service principal's burst allowance now see their own (lower) limits. Third, card refresh events that tighten contracts invalidate the adapter cache immediately, so the stale-window widening is eliminated. The cost is real: some calls that used to succeed now fail, and the failures are *correct* failures that expose previously hidden over-permissioning. The operational discipline is to treat the new rejections as a capability audit, not a regression — each `WarrantSubsetViolation` is a record of a call that was silently over-authorized before the invariant existed. The gateway's job is not to maximize successful translations; it is to guarantee that every successful translation is a subset of the caller's warrant. A gateway that cannot make that guarantee for a given backend must refuse to bridge it. ```python from dataclasses import dataclass, field from typing import FrozenSet, Optional class WarrantSubsetViolation(RuntimeError): """Raised when a derived downstream call exceeds the caller's warrant.""" class UngovernableBackend(RuntimeError): """Raised when a backend cannot carry caller identity for rate governance.""" @dataclass(frozen=True) class Warrant: subject: str scopes: FrozenSet[str] rate_class: str tenant: str parameter_domain: FrozenSet[str] def dominates(self, other: "Warrant") -> bool: return ( self.subject == other.subject and other.scopes <= self.scopes and other.rate_class == self.rate_class and other.tenant == self.tenant and other.parameter_domain <= self.parameter_domain ) @dataclass class DerivedCall: params: dict synthesized: set = field(default_factory=set) def derive_downstream( caller: Warrant, source_schema: FrozenSet[str], target_schema: FrozenSet[str], caller_supplied: dict, backend_can_propagate_identity: bool, ) -> DerivedCall: if not backend_can_propagate_identity: raise UngovernableBackend( f"backend cannot carry subject {caller.subject!r}; " "rate governance would key on proxy identity" ) synthesized = target_schema - source_schema params = dict(caller_supplied) for name in synthesized: # Never default to a liveness value; draw from warrant or reject. if name == "scope": if "*" in caller.scopes: params[name] = "*" elif len(caller.scopes) == 1: params[name] = next(iter(caller.scopes)) else: raise WarrantSubsetViolation( f"cannot synthesize 'scope' from multi-scope warrant " f"{sorted(caller.scopes)} without explicit narrowing" ) elif name == "tenant": params[name] = caller.tenant elif name in caller.parameter_domain: params[name] = name # caller-domain-bound; flagged below else: raise WarrantSubsetViolation( f"target requires {name!r} not bounded by caller warrant" ) derived = DerivedCall(params=params, synthesized=synthesized) # Subset check: every param value must be bounded by the caller's warrant. for name in derived.synthesized: if name not in caller.parameter_domain and name not in {"scope", "tenant"}: raise WarrantSubsetViolation( f"synthesized param {name!r} outside caller parameter_domain" ) return derived def emit(downstream: DerivedCall, caller: Warrant, live_card_widened: bool) -> dict: if live_card_widened: raise WarrantSubsetViolation( "live agent card is wider than cached card; fail-closed on tightening" ) return {"params": downstream.params, "subject": caller.subject} ```