Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for a certificate manager to handle dynamic mTLS certificate rotation within the Request transport class. It encapsulates the mTLS adapter state in a new _MtlsAdapterState class to ensure thread-safe operations and correct behavior during copying. Additionally, the _replace_adapter helper was updated to support replacing previous adapter instances atomically. Comprehensive unit tests have been added to verify single and multi-origin rotation, custom adapter preservation, serialization, and concurrent rotation. I have no feedback to provide as there are no review comments.
nbayati
force-pushed
the
grpc_phase1_pr2a
branch
from
November 27, 2026 00:18
c8c12b5 to
662f7ef
Compare
This branch has not been deployed
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.
Adds an optional
cert_managerparameter togoogle.auth.transport.requests.Requestso long-lived request transports rotate their mTLS HTTPS adapter whenever the shared_MtlsCertManagerfrom #18925 advances to a new certificate generation.When a
cert_manageris provided,Requesttracks the certificate generation its mounted_MutualTlsAdapterwas built from and atomically swaps in a new adapter across every contacted mTLS origin on rotation, leaving caller-mounted custom adapters and sub-path mounts untouched. Shallow and deep copies keep sharing the samecert_manager(and session-scoped lock and adapter state on shallow copies) so background refresh and Regional Access Boundary copies continue rotating, while pickling drops the manager and adapter so unpickled instances rediscover mTLS cleanly.When
cert_manageris omitted,Requestkeeps its existing static mTLS path unchanged. Reactive 401 rotation on standaloneRequestinstances and downstream wiring intocompute_engineandAuthMetadataPluginare handled in follow-up PRs.