fix(integrations): send api registry credentials only to google api endpoints (v1) - #6889
Open
GWeale wants to merge 1 commit into
Open
fix(integrations): send api registry credentials only to google api endpoints (v1)#6889GWeale wants to merge 1 commit into
GWeale wants to merge 1 commit into
Conversation
…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.
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.
Ports
cc275f0c("send api registry credentials only to google api endpoints") tov1, together with its prerequisite41693dce("Add mTLS support for for API registry").ApiRegistry.get_toolsetattaches 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 fromheader_providerinstead.The mTLS commit is carried because it is a predecessor of the fix, not a follow-up: it is what moves the fetch off
httpxand ontoAuthorizedSession, which is what can present a client certificate. Landing the scoping fix alone would leaveapi_registry.pyunable to pass the file-content compliance check, which requires an.mtls.googleapis.comvariant 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
mainthis landed on a class already carrying a[DEPRECATED] ... Use AgentRegistry insteaddocstring fromd3522c00, whichv1never took, sov1users get no prior warning. Callers that need auth for a non-Google server should supply it through theheader_providerargument. Worth calling out in the release notes.Carried:
_is_google_api, and the scoping at theget_toolsetcall site._get_api_registry_url,API_REGISTRY_MTLS_URL, and the cert-source lookup in__init__.httpx.Clienttorequests_auth.AuthorizedSession, so theAuthorizationheader is applied by the session rather than built by hand. The caught exception type moves with it.utils/_mtls_utils.pyholding the two membersapi_registryuses,MtlsEndpointanduse_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), theenabled=falselist filter, andmerge_tracking_headers, none of which this fix depends on.Tests are upstream's, minus the two covering behaviour
v1does not have (the deprecation warning and the tracking header). Reverting the scoping, the endpoint selection, or theconfigure_mtls_channelcall each makes its own test fail.