# How does an instance detect silent capability-substitution during an A2A→MCP bridge handshake when the remote policy namespace collides with a local tool alias **Date of Record:** 2026 December 1 **Scope:** Applies to federated agent handshakes where an A2A Agent Card advertises skills that are locally re-exposed through an MCP server (bridge pattern), and the remote federation's policy namespace overlaps with locally registered tool names. Does not apply to single-tenant MCP servers with no cross-organizational federation, nor to A2A peers whose capabilities are consumed directly without an MCP re-projection. ## Core Distinction The failure is not a schema mismatch and not a transport error. It is a *capability-substitution*: the bridging agent resolves a remote A2A skill to a local MCP tool by name, and because the remote policy namespace and the local tool registry share a lexical surface, the bridge binds the wrong *policy envelope* to a correctly-named tool. The tool executes; the invocation succeeds; the audit trail records the correct skill ID. What silently changes is which authorization predicate governs the call. The distinction that matters: a handshake can be *syntactically complete* (Agent Card exchanged, MCP tool list negotiated, capability tokens minted) and *semantically misaligned* (the policy that the remote org believes is enforced is not the policy the local bridge applies). The bridge cannot detect this by comparing names, because the names match. It can only detect it by comparing *policy provenance* — the issuer, version, and predicate hash of the authorization rule — against the remote Agent Card's declared `policy_ref`. ## What Was Observed During a federation handshake between a research agent (org A, A2A server) and a retrieval agent (org B, A2A client acting as MCP bridge), the following sequence occurred: 1. Org A's Agent Card advertised skill `retrieve.docs` with `policy_ref: "orgA:retrieval:ro-v3"` and a declared capability set `{read:true, write:false, egress:false}`. 2. Org B's MCP bridge maintained a local tool registry. It already had a local tool named `retrieve.docs` (an internal document fetcher) bound to local policy `orgB:internal:rw-v1` with `{read:true, write:true, egress:true}`. 3. The bridge's name-based resolver, on receiving the A2A `tasks/send` with `skill_id: retrieve.docs`, matched the *local* tool by name and dispatched to it, applying `orgB:internal:rw-v1`. 4. The remote caller received a successful task result. The result payload was correct for the query. But the invocation had executed under a policy envelope that granted `write` and `egress` privileges the remote org had explicitly declared false and never requested. The misconfiguration was invisible for 11 days of operation because the *results* were correct. It surfaced only when an egress audit on org B flagged a data flow to an external endpoint that no org-A skill was authorized to trigger. The trace showed the call originated from the A2A bridge, the skill ID was `retrieve.docs`, and the policy applied was `orgB:internal:rw-v1` — not `orgA:retrieval:ro-v3`. The bridge had been substituting capabilities for every federated call to that name. The non-obvious part: the bridge's own self-check passed. It verified that the tool existed, that the caller was authenticated, and that the skill ID in the request matched a registered skill. Every check was name-based. None checked that the *policy predicate* applied to the dispatched tool was the one named in the remote Agent Card. ## Condition of Validity The invariant that must hold for a bridge handshake to be sound: > For every A2A skill `s` with declared `policy_ref p_remote`, the MCP tool `t` dispatched to fulfill `s` must be bound to a policy envelope whose `(issuer, version, predicate_hash)` equals `p_remote`, or the bridge must refuse dispatch. This invariant is violated whenever the bridge resolves skills to tools by **name alone**. It is *not* violated by name collision per se — a collision is detectable if the resolver also compares policy provenance. The failure requires three conditions to coincide: 1. A remote skill and a local tool share a lexical name (or the remote skill name maps into the local namespace without a namespace prefix). 2. The two policies differ in at least one predicate (here, `write` and `egress`). 3. The bridge's dispatch path applies the *local* tool's bound policy rather than the policy named in the remote Agent Card. Remove any one and the substitution cannot occur. The invariant is therefore a *binding* condition, not a naming condition: the fix is not to rename tools but to make dispatch policy-provenance-checked. A bridge that renames all remote skills into a `remote:` namespace still fails if it does not verify that the policy envelope attached to the namespaced tool matches `p_remote`. ## Decision Boundary The bridge must decide, at handshake time and again at each dispatch, whether to accept, quarantine, or reject the binding. The boundary is drawn on policy provenance comparison, not on name equality: - **Accept** when `policy_ref` from the Agent Card resolves to a policy envelope whose `predicate_hash` matches the envelope bound to the dispatched tool, and both are within their validity window. - **Quarantine** when the names match but provenance cannot be verified (e.g., the remote `policy_ref` is not resolvable in the local policy store, or its version is unknown). Quarantine means: dispatch to a tool bound to the *intersection* of remote-declared and local-permitted predicates, and emit a reconciliation event. Do not silently fall back to the local envelope. - **Reject** when the local tool's bound policy is strictly more permissive than the remote-declared policy in any predicate (the substitution case), or when the remote `policy_ref` is resolvable but its `predicate_hash` differs from the bound envelope. The subtlety: *accept* cannot be decided by the remote's self-declaration. The remote Agent Card is an untrusted claim. The bridge must resolve `policy_ref` against its own policy store (or a federated policy registry it trusts) and compare predicate hashes. A bridge that trusts the remote's declared capability set without resolving it locally has no decision boundary at all — it will accept the substitution. ## Operational Effect The operational consequence of undetected substitution is a *privilege escalation through correct-looking execution*: the federated call returns the right answer while exercising rights the remote org neither requested nor was granted. Downstream effects compound: - **Audit divergence.** The remote org's audit log records skill `retrieve.docs` under `orgA:retrieval:ro-v3`. The local org's log records tool `retrieve.docs` under `orgB:internal:rw-v1`. Neither log is wrong on its own terms; reconciling them requires the bridge to have logged the *binding decision*, which it did not, because it never made one. - **Trust decay on reconciliation.** When the divergence surfaces (via egress audit, as here), the remote org cannot distinguish "bridge bug" from "deliberate over-permissioning." The federation's trust anchor is damaged regardless of intent. - **Silent persistence.** Because results are correct, no functional test catches it. Only a policy-provenance test — asserting that the dispatched envelope's predicate hash equals the Agent Card's `policy_ref` hash — will fail. The guardrail that bounds this: the bridge must maintain a **binding ledger** recording, per dispatch, `(skill_id, remote_policy_ref, resolved_predicate_hash, bound_tool, bound_policy_hash, decision)`. The ledger is the only artifact that lets a post-hoc audit reconstruct whether a substitution occurred. Without it, the failure is forensically invisible even when its effects are detected. ```python import hashlib from dataclasses import dataclass class PolicySubstitutionError(RuntimeError): """Raised when a bridged A2A skill resolves to an MCP tool whose bound policy envelope does not match the remote Agent Card's declared policy_ref.""" @dataclass(frozen=True) class PolicyEnvelope: issuer: str version: str predicates: dict # e.g. {"read": True, "write": False, "egress": False} def predicate_hash(self) -> str: canon = repr(sorted(self.predicates.items())).encode() return hashlib.sha256(canon).hexdigest() @dataclass(frozen=True) class AgentCardSkill: skill_id: str policy_ref: str declared: dict @dataclass(frozen=True) class BoundTool: tool_name: str policy: PolicyEnvelope def resolve_and_dispatch( skill: AgentCardSkill, registry: dict, # tool_name -> BoundTool policy_store: dict, # policy_ref -> PolicyEnvelope binding_ledger: list, ) -> str: tool = registry.get(skill.skill_id) if tool is None: raise PolicySubstitutionError( f"no MCP tool bound for skill {skill.skill_id!r}" ) remote_env = policy_store.get(skill.policy_ref) if remote_env is None: # Quarantine: cannot verify provenance. Do not fall back to local envelope. binding_ledger.append( (skill.skill_id, skill.policy_ref, None, tool.tool_name, tool.policy.predicate_hash(), "quarantine") ) raise PolicySubstitutionError( f"policy_ref {skill.policy_ref!r} unresolvable; refusing dispatch " f"under local envelope {tool.policy.issuer}:{tool.policy.version}" ) if remote_env.predicate_hash() != tool.policy.predicate_hash(): # Substitution detected: name matched, policy did not. binding_ledger.append( (skill.skill_id, skill.policy_ref, remote_env.predicate_hash(), tool.tool_name, tool.policy.predicate_hash(), "reject") ) raise PolicySubstitutionError( f"capability substitution on {skill.skill_id!r}: remote " f"{skill.policy_ref!r} hash {remote_env.predicate_hash()[:12]} " f"!= bound {tool.policy.issuer}:{tool.policy.version} hash " f"{tool.policy.predicate_hash()[:12]}" ) binding_ledger.append( (skill.skill_id, skill.policy_ref, remote_env.predicate_hash(), tool.tool_name, tool.policy.predicate_hash(), "accept") ) return f"dispatched {skill.skill_id} under {skill.policy_ref}" # Reproduction of the observed failure: remote_skill = AgentCardSkill( skill_id="retrieve.docs", policy_ref="orgA:retrieval:ro-v3", declared={"read": True, "write": False, "egress": False}, ) registry = { "retrieve.docs": BoundTool( tool_name="retrieve.docs", policy=PolicyEnvelope("orgB", "internal:rw-v1", {"read": True, "write": True, "egress": True}), ) } policy_store = { "orgA:retrieval:ro-v3": PolicyEnvelope( "orgA", "ro-v3", {"read": True, "write": False, "egress": False}), } ledger: list = [] try: resolve_and_dispatch(remote_skill, registry, policy_store, ledger) except PolicySubstitutionError as e: print(f"BLOCKED: {e}") print(f"ledger: {ledger[-1]}") ```