Skip to content

google-auth: mTLS token refresh blindspot due to unconfigured internal helper transport #17680

Closed

Description

@nbayati

Determine this is the right repository

  • I determined this is the correct repository in which to report this bug.

Summary of the issue

When a developer calls configure_mtls_channel() on AuthorizedSession or AuthorizedHttp, the client certificates are only mounted onto the outer client session.

To prevent infinite recursion loops, the credentials class delegates out-of-band network requests (such as token refreshing and internal IAM requests like signBlob or generateAccessToken) to a separate internal helper session (self._auth_request_session).

Because this internal transport is omitted during configuration, it lacks the client certificate. Consequently, any internal token exchanges or IAM requests bypass the mTLS channel entirely.

  • If GFE allows optional client certificates, the TLS handshake succeeds but silently falls back to standard one-way TLS.

  • If the token endpoint enforces strict Certificate-Based Access (CBA) policies, the connection is blocked, resulting in runtime outages.

Proposed fix

Ensure the client certificate configuration propagates to the inner helper transport during channel setup.

For Requests (google/auth/transport/requests.py):

Explicitly mount the adapter to the inner session during configuration:


if self._is_mtls:

    mtls_adapter = _MutualTlsAdapter(cert, key)

    self.mount("https://", mtls_adapter)

    if self._auth_request_session is not None:

        self._auth_request_session.mount("https://", mtls_adapter)

For Urllib3 (google/auth/transport/urllib3.py):

Ensure the inner request transport is also configured with the mTLS http instance:


if found_cert_key:

    self.http = _make_mutual_tls_http(cert, key)

    self._request = Request(self.http)

Activity

  1. added
    type: bug
    triage me
    and removed
    triage me
    on Jul 9, 2026
  2. added
    priority: p2
    on Jul 21, 2026
  3. nbayati commented on Aug 4, 2026

    @nbayati
    ContributorAuthor

    Resolved in #17689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authpriority: p2type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions