feat(google-auth): grpc cert rotation handling#16597
Draft
agrawalradhika-cell wants to merge 9 commits intogoogleapis:mainfrom
Draft
feat(google-auth): grpc cert rotation handling#16597agrawalradhika-cell wants to merge 9 commits intogoogleapis:mainfrom
agrawalradhika-cell wants to merge 9 commits intogoogleapis:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism for mTLS certificate rotation in gRPC channels by implementing a refreshing channel wrapper and a call interceptor. The review identified several issues: a missing logger definition causing potential runtime errors, a typo in a variable name, redundant parameters in the interceptor, the use of print statements instead of logging, and a lack of support for non-unary gRPC call types and context manager patterns.
| """Indicates if the created SSL channel credentials is mutual TLS.""" | ||
| return self._is_mtls | ||
|
|
||
| class _MTLSCallInterceptor(grpc.UnaryUnaryClientInterceptor): |
Contributor
Comment on lines
+405
to
+410
| def __init__(self, target, factory_args, initial_channel, initial_cert): | ||
| self._target = target | ||
| self._factory_args = factory_args | ||
| self._channel = initial_channel | ||
| self._cached_cert = initial_cert | ||
| self._lock = threading.Lock() |
Contributor
There was a problem hiding this comment.
_MTLSRefreshingChannel should implement __enter__ and __exit__ to support being used as a context manager, which is a standard pattern for gRPC channels.
def __init__(self, target, factory_args, initial_channel, initial_cert):
self._target = target
self._factory_args = factory_args
self._channel = initial_channel
self._cached_cert = initial_cert
self._lock = threading.Lock()
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self.close()Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.
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:
Fixes #<issue_number_goes_here> 🦕