Skip to content

fix(integrations): send api registry credentials only to google api endpoints (v1) - #6889

Open
GWeale wants to merge 1 commit into
v1from
fix-v1-api-registry-credentials
Open

fix(integrations): send api registry credentials only to google api endpoints (v1)#6889
GWeale wants to merge 1 commit into
v1from
fix-v1-api-registry-credentials

Conversation

@GWeale

@GWeale GWeale commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Ports cc275f0c ("send api registry credentials only to google api endpoints") to v1, together with its prerequisite 41693dce ("Add mTLS support for for API registry").

ApiRegistry.get_toolset attaches the caller's own ADC bearer token to whatever host a registry entry names. A registry entry can name any host, so a non-Google MCP server registered in the project receives the caller's credentials. Upstream fixed this by scoping the header to Google API endpoints; other servers get their headers from header_provider instead.

The mTLS commit is carried because it is a predecessor of the fix, not a follow-up: it is what moves the fetch off httpx and onto AuthorizedSession, which is what can present a client certificate. Landing the scoping fix alone would leave api_registry.py unable to pass the file-content compliance check, which requires an .mtls.googleapis.com variant alongside any Google endpoint literal in a changed file.

Breaking change. A non-Google MCP server that relied on receiving the caller's credentials starts getting 401. On main this landed on a class already carrying a [DEPRECATED] ... Use AgentRegistry instead docstring from d3522c00, which v1 never took, so v1 users get no prior warning. Callers that need auth for a non-Google server should supply it through the header_provider argument. Worth calling out in the release notes.

Carried:

  • _is_google_api, and the scoping at the get_toolset call site.
  • _get_api_registry_url, API_REGISTRY_MTLS_URL, and the cert-source lookup in __init__.
  • The fetch loop moves from httpx.Client to requests_auth.AuthorizedSession, so the Authorization header is applied by the session rather than built by hand. The caught exception type moves with it.
  • A new utils/_mtls_utils.py holding the two members api_registry uses, MtlsEndpoint and use_client_cert_effective, at the same path and under the same names as upstream so a later backport extends it rather than reconciling a divergence.

Not carried: d3522c00 (the deprecation), the enabled=false list filter, and merge_tracking_headers, none of which this fix depends on.

Tests are upstream's, minus the two covering behaviour v1 does not have (the deprecation warning and the tracking header). Reverting the scoping, the endpoint selection, or the configure_mtls_channel call each makes its own test fail.

…ndpoints (v1)

ApiRegistry attaches the caller's ADC bearer token to whatever host a
registry entry names, so a non-Google MCP server registered in the
project receives the caller's credentials. Scope the header to Google
API endpoints; other servers get theirs from header_provider.

Carries the prerequisite mTLS commit, which moves the registry fetch
from httpx to AuthorizedSession so a client certificate can be
presented, and adds the two _mtls_utils members it needs.
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.

2 participants