feat(auth): make RAB feature production ready#17390
Open
nbayati wants to merge 6 commits into
Open
Conversation
…lookup Initialize impersonated credentials inside ExternalAccountCredentials.__init__() when an impersonation URL is set. This ensures that RAB lookup targets the Service Account endpoint.
Contributor
There was a problem hiding this comment.
Code Review
This pull request enables the Regional Access Boundary (RAB) feature by default by removing the GOOGLE_AUTH_TRUST_BOUNDARY_ENABLED environment variable gate. It also expands regional endpoint detection to support MTLS domains and updates external account credentials to initialize impersonated credentials immediately, delegating token and expiry management. Unit tests have been adjusted to remove obsolete environment variable mocks and to mock the RAB allowed locations endpoint. There are no review comments, so I have no feedback to provide.
macastelaz
approved these changes
Jun 8, 2026
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.
This PR resolves issues identified during verification of gcloud Regional Access Boundary (RAB) flows and enables RAB verification by default:
GOOGLE_AUTH_TRUST_BOUNDARY_ENABLED) to execute RAB lookups by default across standard credential classes..rep.mtls.googleapis.com), bypassing redundant RAB lookups on secure transport boundaries.ExternalAccountCredentials.__init__(), guaranteeing that cached access tokens restored across external CLI entrypoints route down to target Service Account RAB verification hooks.aws.py,identity_pool.py) to bind custom supplier attributes prior to callingsuper().__init__(), preventingAttributeErrorcrashes during early impersonation cloning.a note on the last change: When we updated Workload Identity Federation credentials to initialize Service Account impersonation immediately upon creation (to address no3 and to ensure cached tokens route correctly to Regional Access Boundary endpoints), it exposed an initialization order issue when credentials were loaded programmatically via a custom supplier. Because the parent class creates an internal copy of the credential during its base setup, it attempted to copy the custom supplier attribute before the subclass had saved it on the object, causing an AttributeError. Reordering the constructor to bind custom supplier attributes before calling super().init() resolves this cloning crash.