Files
George Weale 301efcf8f0 fix: constrain the RPC targets of a network-fetched A2A agent card (v1)
Before this change, `RemoteA2aAgent` accepted whatever RPC URL an agent card
advertised. Validation only checked that the card's `url` was non-empty and
parsed into a scheme and a netloc, so a card fetched over the network could
point the conversation, and any auth the client attaches to it, at any host,
over cleartext if it liked. Endpoints beyond the top-level `url` were not
looked at at all, even though the client factory negotiates its transport
across the card's whole interface list and can pick one of them.

Now, when the card was fetched over http or https, every URL it advertises
must use https and match the origin the card came from, comparing scheme,
host and port. Plain http stays allowed on a loopback host, which is the
shape the A2A local-development helpers emit. A card supplied as an
`AgentCard` object or read from a local file is left alone, since it did not
come off the network.

Behaviour change: a deployment that serves its agent card from one host and
its RPC endpoint from another now raises `AgentCardResolutionError` instead
of connecting, and so does one that advertises a cleartext endpoint off
loopback. A differing port counts as a differing origin. Because the origin
is compared against the URL that was configured rather than the one that
finally answered, a card reached through a redirect to another origin is
rejected as well. Passing the `AgentCard` object directly or pointing
`agent_card` at a local file remains available for those cases.

The upstream change routes endpoint enumeration through a compatibility
module that straddles `a2a-sdk` 0.3.x and 1.x. This branch pins
`a2a-sdk>=0.3.4,<0.4`, so the 0.3.x behaviour is implemented directly as a
private helper in `remote_a2a_agent.py` instead.
2026-08-17 23:00:12 +00:00
..
2026-01-20 14:50:09 -08:00