Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for retrieving and validating the active Cloud SDK universe domain in UserAccessTokenCredentials. It introduces a get_universe_domain helper in _cloud_sdk.py to fetch the domain from the environment or via the gcloud CLI, and updates the credentials refresh process to validate and verify that the resolved universe domain matches the default universe domain. A critical issue was identified in _cloud_sdk.py where the use of the unimported _helpers module will cause a NameError at runtime; it is recommended to decode the bytes directly instead.
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.
Resolve and validate the active Cloud SDK universe domain in
UserAccessTokenCredentials.This PR includes the following changes:
get_universe_domain()ingoogle/auth/_cloud_sdk.py, checkingGOOGLE_CLOUD_UNIVERSE_DOMAINfirst and falling back togcloud config get core/universe_domain.universe_domainproperty onUserAccessTokenCredentials(ingoogle/oauth2/credentials.py, inherited by_credentials_async.UserAccessTokenCredentials) that validates the resolved domain via_helpers.validate_universe_domain(), updatesself._universe_domain, and preserves cached state acrosswith_account()andwith_quota_project().UserAccessTokenCredentials.refresh()resolves and validatesself.universe_domainbefore calling_cloud_sdk.get_auth_access_token(), reusing the cached value on subsequent refreshes.