Skip to content

fix: use TLS by default for built-in gRPC connections - #114

Merged
yarolegovich merged 5 commits into
a2aproject:mainfrom
Math1987:codex/grpc-client-tls
Nov 3, 2026
Merged

yarolegovich merged 5 commits into
a2aproject:mainfrom
Math1987:codex/grpc-client-tls

Conversation

@Math1987

@Math1987 Math1987 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

The built-in gRPC client failed before connecting to a TLS-enabled agent because the CLI supplied no transport credentials by default. This change enables TLS with the system trust store for A2A 1.0 and 0.3. Local plaintext servers remain accessible with --insecure.

The same gRPC endpoint now works when passed directly or advertised as an HTTPS URL in an Agent Card. The latter case came up when comparing with the Rust SDK's TLS example.

The regression tests send a message over TLS, exercise direct and card-based connections, reject an untrusted certificate and a hostname mismatch, and cover explicit plaintext mode.

Fixes #99

Which area does this relate to?

  • CLI code
  • SPEC or COMPLIANCE file
  • Other doc files

Checklist

  • Reviewed the contributing guide and used a Conventional Commits title.
  • Ran go mod tidy -diff, go build -mod=readonly ./..., go test -race -mod=readonly -count=1 -shuffle=on ./..., and golangci-lint run.
  • Updated the command reference with the default trust policy and plaintext option.

Use the system trust store to verify gRPC servers for A2A 1.0 and 0.3. Accept gRPC addresses advertised as HTTPS URLs in Agent Cards and keep --insecure available for plaintext servers.

Fixes a2aproject#99
With TLS on by default, a plaintext gRPC server such as
`a2a server --serve-transport grpc` fails the handshake with "tls: first
record does not look like a TLS handshake", and the hint for the old
"no transport security set" error never fires. Classify reports that
failure as an IO error with a hint to pass --insecure.

The test serves plaintext with grpc.Server.Serve, which answers a TLS
ClientHello the way a gRPC agent does, and uses a named-field table with
t.Fatalf.
newClientFromCard stripped the http(s) scheme from the card's gRPC
interface URLs in place, so client.Card() returned the rewritten URLs and
the client's endpoint no longer matched the agent's card. The CLI
registers its own gRPC transport factories that strip the scheme only
when dialing, for both the card and the --endpoint path.
--insecure turns TLS off for the built-in gRPC client, which is more than disabling certificate verification. The warning also fires when the selected transport is REST or JSON-RPC, so it describes what --insecure does without naming the transport in use.
@yarolegovich

Copy link
Copy Markdown
Member

merging with a small fixes

@yarolegovich
yarolegovich merged commit 7510bd5 into a2aproject:main Nov 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: built-in gRPC client cannot connect with TLS

2 participants