Skip to content

feat(google-api-core): wire mTLS certificate rotation into create_channel - #19285

Draft
nbayati wants to merge 1 commit into
grpc_phase1_pr4bfrom
grpc_phase1_pr5
Draft

nbayati wants to merge 1 commit into
grpc_phase1_pr4bfrom
grpc_phase1_pr5

Conversation

@nbayati

@nbayati nbayati commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

…nnel

create_channel now accepts client_cert_source and returns a
_RotatingGrpcChannel backed by google-auth's _MtlsCertManager when mTLS
is active, so channels pick up rotated client certificates without
recreating the client. The manager is shared with AuthMetadataPlugin and
its Request so tokens and the TLS connection use the same certificate.

DirectPath, explicit ssl_credentials, and support_mtls_channel_rotation=False
keep the existing unwrapped channel. Older google-auth releases without
_MtlsCertManager fall back to static SSL credentials and log a warning
when mTLS is active.
@nbayati
nbayati added this pull request to stack #19182 December 1, 2026 00:43

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for mutual TLS (mTLS) channel rotation in grpc_helpers.py. It adds helper functions to check for ambient mTLS configurations, load certificate managers, and construct rotating gRPC channels that can rebuild themselves with updated client certificates. Additionally, it refactors credential creation logic and includes comprehensive unit tests to verify the new mTLS rotation features and fallback mechanisms. I have no feedback to provide as there are no review comments.

This branch has not been deployed

No deployments
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.

1 participant