>
Trust3 AI Labs
Engineering

Securing A2A’s Two Attack Surfaces: Ingress vs. Egress

Key Takeaways

  • A2A calls are one more entry point for prompt injection: a receiving agent has no way to tell trusted instruction from another agent’s payload, the same failure OWASP’s 2026 Excessive Agency risk names
  • A2A splits into two attack surfaces: agent-to-agent (ingress) and agent-to-tool (egress); a gateway that governs one often says nothing about the other
  • In this deployment, ingress runs on Cloud Run IAM bearer tokens alone; egress runs through VPC topology plus Agent Gateway policy, a stronger guarantee
  • Authentication and authorization are separate questions: platform IAM answers both coarsely (service-level invoke), while DIY code can answer authorization finer (per-tool, per-argument) at the cost of custom bug surface
  • Who authors the agent, hand-written SDK vs no-code/low-code platform, determines whether that authorization choice is even visible to audit
  • Trust boundary distance (intra-org, cross-org, cross-company) amplifies both of those choices, down to the agent card being the only trust anchor cross-company
  • No mechanism here propagates the originating caller’s identity end-to-end; Signed Agent Cards and research like AIP target this problem without yet closing it

A remote agent gets discovered, mints a token, and calls another agent directly. That same agent then calls a tool over MCP, and a gateway in the network path stops, inspects, and logs the call. Same deployment, two different security postures. It rarely gets designed that way on purpose. It’s what happens when “put a gateway in front of your agents” meets how A2A and MCP actually route traffic.

We built a small reference deployment to see it: a Google ADK agent (research_worker) exposed over A2A and discoverable by an external agent through Agent Registry, which in turn calls an internal MCP tool server across a VPC with an Agent Gateway enforcing policy on egress. Two hops, two threat models, one repo.

The claim: A2A traffic has two attack surfaces, agent-to-agent (ingress) and agent-to-tool (egress), and a gateway that governs one often says nothing about the other. Two choices shape how exposed ingress ends up: how auth is set up, and who authored the agent. A third factor, how far the call travels before crossing a trust boundary, amplifies both. Underneath all of it sits a more basic question: what one allowed call actually grants.

A2A in 30 seconds

Agent-to-agent (A2A) is a protocol for one agent to discover and call another over JSON-RPC. An agent publishes an agent card, a small JSON document describing what it does and where to reach it, at a well-known URL:

{
 "name": "research_worker",
 "description": "Specialized remote worker for deep research",
 "url": "https://<research-worker-service>.a.run.app/a2a/research_worker",
 "version": "1.0.0",
 "capabilities": { "streaming": false },
 "skills": [
 { "id": "deep_research", "name": "Deep Research", "tags": ["research", "analysis"] }
 ]
}

A caller fetches that card (/.well-known/agent-card.json), then sends work with the message/send method:

curl -X POST "$SERVICE_URL/a2a/research_worker" \
 -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
 -d '{"jsonrpc":"2.0","id":"1","method":"message/send","params":{"message":{
 "role":"user","parts":[{"kind":"text","text":"What is the price of AAPL?"}],
 "messageId":"m1"}}}'

That’s the whole mechanism: publish a card, get discovered, accept JSON-RPC calls. A2A is past the experimental stage. It crossed 150 supporting organizations in its first year, is hosted under the Linux Foundation’s Agentic AI Foundation, and ships a stable v1.0 spec with production deployments across multiple clouds. The spec is also explicit that identity is deliberately kept out of A2A’s own semantics, handled at whatever transport-level auth the deployment chooses, and that credentials should be bound to the agent that originated a request so they can’t be replayed further down a chain. That’s a spec-level acknowledgment of the problem the rest of this post walks through: the protocol says nothing about who’s allowed to call, what identity that caller acts on behalf of, or what happens once the receiving agent needs a tool of its own. Those are deployment decisions.

The problem underneath the mechanics

Everything that follows is about whether a call is allowed. A permitted call is not automatically a scoped one, and the exposure here is not unique to agents talking to agents.

Any surface where text enters a model’s context and gets treated as instruction is the same exposure, whether that text comes from a human typing into a chat box, a document an agent retrieves, or another agent’s A2A message. OWASP’s Top 10 for LLM Applications ranks prompt injection first for this reason: LLMs process instructions and untrusted content within the same context, with no reliable way to distinguish one from the other. A2A doesn’t introduce a new category of vulnerability. It adds another entry point to the same one, and the 2026 revision of that list, the first written for the agentic era, moved Excessive Agency up to third for a related reason: an agent acting on more capability than a given request warranted.

A2A sharpens it. A human typing into a chat box brings whatever access that human’s own session has. An agent calling another agent over A2A brings the calling agent’s text, arriving with the receiving agent’s standing capability behind it, not the caller’s. Once research_worker clears Cloud Run IAM, its incoming message is just text, and research_worker has no way to distinguish instructions from the human who originally wanted this work done from whatever the calling agent decided to put in that field. It executes against its own McpToolset, which reaches every tool market_data_mcp exposes rather than the one the request actually needed. A message crafted to redirect that capability, whether the calling agent is malicious or just relaying an instruction it picked up somewhere upstream, is bound only by what research_worker itself is provisioned to do.

The next few sections describe this coarseness from the mechanism side. Here it shows up as behavior. IAM decides can-this-caller-invoke, once, at the service boundary. Nothing downstream narrows what the call can do once it’s inside, and nothing distinguishes the caller’s intent from the caller’s payload:

Chain a second agent onto this, research_worker calling a further agent, which this demo doesn’t do but which is the entire premise of multi-hop A2A, and the same absence of narrowing compounds: each hop inherits whatever standing access the next agent holds, not a reduced subset of what the original caller should be trusted for. Who that chain traces back to, and whether anything records it, is the subject of “Where identity actually goes” below.

The two surfaces, in one deployment

research_worker has two outbound relationships, and they’re governed by different mechanisms.

Same deployment, two legs. Only the egress leg has no route around it.

Ingress: an external agent calls research_worker. Authenticated by Cloud Run IAM, a bearer OIDC token scoped to the service’s audience. No gateway sits in this path. Google’s Agent Gateway (part of the Gemini Enterprise Agent Platform) does offer an ingress mode, Client-to-Agent, but its own docs are explicit that in this mode the agent must live in the same project as the gateway. That’s a stated scope limit, and it means this mode was never going to cover a cross-project caller like the one in our demo. The mode Google’s setup docs and codelab actually document end-to-end is the egress one, Agent-to-Anywhere, which explicitly allows the agent and the gateway to sit in different projects.

Egress: research_worker calls an MCP tool server. This leg is enforced by network topology rather than a policy check an agent could route around.

# egress-gateway.yaml (abbreviated; PSC attachment detail is in the figure above)
protocols: [MCP]
governedAccessPath: AGENT_TO_ANYWHERE

research_worker runs with Direct VPC Egress, configured with these flags:

--network=agent-demo-vpc --subnet=agent-gateway-subnet --vpc-egress=all-traffic

The MCP server, market_data_mcp, is deployed with --ingress=internal, unreachable from the public internet at all:

curl -I https://<market-data-mcp-service>.a.run.app/mcp
# HTTP/2 404: blocked by the Google Frontend before it reaches the service

Two gotchas before you try it yourself. Direct VPC Egress with --vpc-egress=all-traffic needs Private Google Access enabled on the subnet to reliably reach Google APIs and internal Cloud Run services over private IPs. And FastMCP’s default DNS-rebinding protection rejects Cloud Run’s own *.run.app Host headers with a 421 unless you flip two settings: disable DNS-rebinding protection and allow all hosts.

The ingress leg is secured by a policy check, does this bearer token carry run.invoker, which is real but bypassable by anything holding a valid token. The egress leg is secured by the absence of a route: market_data_mcp isn’t reachable except through the one path the gateway sits on. That’s a stronger guarantee, and also the harder one to stand up correctly.

So when someone says “we put an AI gateway in front of our agents,” the first question is which direction, and which mode. It’s possible to have real, topology-level enforcement on egress and nothing but a bearer-token check on ingress, and not notice, because “gateway” sounds like it covers everything in front of the agent.

Authentication and authorization aren’t the same choice

Teams talk about “auth” as one thing. This deployment forces you to separate two questions: who is this caller (authentication), and what is this caller allowed to do (authorization). Cloud platforms and hand-written code answer them at different grain sizes, and the space between those grain sizes is where risk hides.

Cloud-platform-native, what this deployment does on ingress: Cloud Run IAM validates the OIDC token (authentication) and checks a role binding, roles/run.invoker (authorization), in one motion. That’s a real, verifiable identity check. It’s also coarse: the decision is binary, can this principal invoke the service at all, with nothing finer underneath it. research_worker exposes one skill in its agent card today, but IAM’s grant doesn’t know that; the same invoker role would authorize a caller for every skill and every tool the agent ever grows.

DIY, the alternative this codebase explicitly declines: you could check the caller’s identity and scope inside agent.py itself, verify a claim, look up a policy table, decide per tool call whether this specific caller can invoke this specific skill with these specific arguments. That’s finer-grained than anything IAM expresses on its own. It’s also custom code with its own bug surface, sitting in a file that today has none, no per-tool authorization check anywhere in agent.py, by design, gated at the platform layer instead.

The egress leg shows the contrast. The Agent Gateway policy sitting on that path is scoped to protocol and tool (protocols: [MCP]), a genuinely finer authorization grain than IAM’s service-level invoker role. That’s a second, independent reason the egress leg ends up more tightly governed than ingress here: it has a policy layer expressing tool-level decisions that ingress has no equivalent of.

Who authored the agent shapes the same exposure differently

The choice above is a platform-level one: IAM’s grant, or custom code. An adjacent choice determines whether that platform-level choice is even visible to the team running it: who wrote the agent. research_worker is hand-written against Google’s ADK, a Python Agent object, an McpToolset, a system prompt. Its authorization posture, IAM-only, no per-tool check, is a decision anyone reading agent.py can see and audit in a few dozen lines.

A no-code or low-code agent platform inherits the same underlying choice from the other direction. You don’t write an equivalent file at all; the platform’s runtime owns the tool-calling loop and whatever identity model it ships with, IAM-backed, a proprietary scheme, or something in between. You trade visibility into that logic for not having to write it, and now it lives inside a vendor runtime you can audit far less directly than a few dozen lines of Python.

Neither is inherently safer. A DIY agent is as secure as the platform gate its author configured, and you can verify that by reading the code. A low-code agent is as secure as the platform’s own model, which this repo can’t speak to. That’s an architectural point rather than something the demo shows.

What amplifies both choices: how far the call travels

Both choices above get riskier the same way, they scale with how far the call travels before it crosses a trust boundary.

Each step down widens the trust boundary and thins out what’s actually checked, until at cross-company the agent card itself becomes the trust anchor, and until recently nothing stopped that card from describing an agent it doesn’t belong to. A2A’s v1.0 spec adds Signed Agent Cards, cryptographic signatures over the card’s contents, aimed at this problem. Whether it closes it depends entirely on whether a given registry actually issues and verifies those signatures; the mechanism existing and a deployment using it are two different facts.

None of this changes which mechanism protects the ingress leg, or who authored the code behind it. It changes how much you’re trusting that mechanism, and that author’s choices, to hold.

Where identity actually goes

None of these mechanisms establish who the call is for. It is the identity-layer version of the scope problem above. Cloud Run IAM confirms a caller holds a valid credential. It says nothing about the human or upstream system that caller is acting on behalf of. The README is explicit:

IAM confirms that a caller is allowed to reach the service; it does not automatically populate anything inside the ADK session, e.g. tool_context.session.user_id is just whatever value the client passed when creating the session, not a verified principal.

Any field an agent framework exposes for “who is this session for” is only as trustworthy as whatever the calling agent chose to put there, unless something in the chain independently verifies and propagates it. That’s true whether the call is intra-org or cross-company, DIY or low-code. Adding a gateway to either leg doesn’t change it, because a bearer token and a network path both answer “can this call happen,” not “on whose authority.”

Recent research on an Agent Identity Protocol (AIP) proposes binding a token format to identity resolution across both MCP and A2A specifically to close it. It’s research and an IETF Internet-Draft, not a deployed standard, and nothing in this post’s deployment ships it. But it’s a sign the problem named here is treated as open rather than as an edge case.

Where this leaves you

Every mechanism in this deployment answers “can this call happen.” None of them answer “on whose authority, and for what.” That second question is what Trust3 AI is built for: the originating user’s identity and declared purpose travel with the request through every A2A hop and every MCP call to the data source, scope can only narrow down the chain, and every hop, tool call, and policy decision lands in one correlated audit record tied to the person who started the work. The gateway still decides whether the pipe is open. Trust3 AI decides what is allowed to move through it.

Questions worth asking before you deploy

  • Does a receiving agent’s tool access get scoped down per request, or does every allowed call get the agent’s full standing capability?
  • Which leg does your gateway actually sit on, agent-to-agent or agent-to-tool, and which mode, ingress or egress? Ask for the network diagram, not the product description.
  • If your gateway only governs egress, what secures the inbound A2A calls your agents receive? A bearer-token check is a real control, but a much weaker one than a missing route.
  • What’s the finest-grained authorization decision your platform IAM can actually express, service-level, tool-level, or per-argument, and does anything in your stack operate below that line?
  • If you’re on a low-code platform, can you actually see the authorization logic running per tool call, or are you trusting a default you’ve never read?
  • Does your agent registry issue and verify Signed Agent Cards, or just serve whatever card was uploaded?
  • Does your agent framework’s user_id or “principal” field get populated by anything that verifies it, or is it just whatever the caller sent?

FAQ

Does an AI gateway secure A2A traffic? Only on the leg and mode it’s positioned on. Google’s own ingress mode is scoped to same-project agents, and registered A2A calls discovered cross-project or cross-org can bypass it. Check which direction and mode yours enforces before assuming coverage.

What actually stops a request from reaching an internal tool server? In this deployment, the absence of a route: --ingress=internal plus VPC-only egress. There is no policy decision for an agent to route around.

Is A2A a different vulnerability than prompt injection? No. It’s the same failure, untrusted text sharing a context with trusted instruction, arriving through a new entry point that happens to carry another agent’s credentials with it.

Do Signed Agent Cards solve the cross-company trust problem? They solve card authenticity, not authorization. A signed card proves the card wasn’t tampered with; it doesn’t establish what the agent behind it should be allowed to do, or propagate the identity of whoever originally asked for the work.

Does crossing an org boundary change which mechanism protects the ingress leg? No. It’s IAM either way. It changes how much is riding on that one check, since there’s no shared root of trust to fall back on cross-company.

Let’s chat further here: Book a Trust3 AI demo

Related research