Repository navigation
feat(a2a): authenticate A2A calls to the gateway and surface its refusals - #1543
Merged
Merged
Conversation
…sals An agent URL on the origin of gateway.url now gets gateway.api_key as its bearer token on every A2A request. Credentials for the gateway in agents.yaml take precedence, and the token never leaves the gateway's origin. A guardrail refusal, a 403 with a JSON-RPC error, reaches the model with the policy's message instead of as an authentication failure. Closes #1515
Contributor
|
🎉 This PR is included in version 0.226.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With
AUTH_ENABLEDthe gateway requires a bearer token onPOST /a2a, the same token it requires for inference.inferheld that token asgateway.api_keybut sent it on inference only, so every A2A call to an authenticated gateway was rejected.gateway.urlnow getsgateway.api_keyas its bearer token on the agent card fetch,SendMessage, backgroundGetTaskpolling andCancelTask.authblock for the gateway inagents.yaml([FEATURE] Authenticate to A2A agents with per-agent credentials #1514) takes precedence overgateway.api_key.Authentication failed for A2A agent "<host>": the agent rejected the request with status 401, check gateway.api_key. The response body stays out of it.The request was refused by a guardrail policy: <policy message>. A 403 without a JSON-RPC error stays an authentication failure.gateway.url. SoINFER_GATEWAY_MOCKstill authenticates A2A calls to the configured gateway.docs/a2a-connections.mddocuments authenticating to the gateway.Known limit: with
gateway.runand a port the CLI reassigned, the match uses the configuredgateway.url.Closes #1515
Test plan
go test ./...andgo test -race ./internal/protocols/a2a/...task precommit:runinfrastructure/auth_test.go: the header on each request type, no header for another origin or a redirect target,agents.yamlcredentials beat the gateway key, and the 401 and 403 pathsexamples/a2a-gateway-auth([FEATURE] Add examples/a2a-gateway-auth to demonstrate guardrails, authentication and telemetry on A2A traffic #1513) with a local build against a gateway with OIDC auth and guardrailsDocs follow-up
Draft of a
[DOCS]issue forinference-gateway/docs, not filed yet:[DOCS] CLI: authenticate A2A calls to the gatewaygateway.api_keyis sent as the bearer token on A2A requests togateway.url,agents.yamlcredentials take precedence, and a guardrail refusal reaches the model with the policy message