Skip to content

feat(auth): make RAB feature production ready#17390

Open
nbayati wants to merge 6 commits into
googleapis:mainfrom
nbayati:rab-follow-up
Open

feat(auth): make RAB feature production ready#17390
nbayati wants to merge 6 commits into
googleapis:mainfrom
nbayati:rab-follow-up

Conversation

@nbayati
Copy link
Copy Markdown
Contributor

@nbayati nbayati commented Jun 8, 2026

This PR resolves issues identified during verification of gcloud Regional Access Boundary (RAB) flows and enables RAB verification by default:

  • Removes the client-side environment variable feature gate (GOOGLE_AUTH_TRUST_BOUNDARY_ENABLED) to execute RAB lookups by default across standard credential classes.
  • Updates the Python auth SDK to recognize mTLS regional endpoints (.rep.mtls.googleapis.com), bypassing redundant RAB lookups on secure transport boundaries.
  • Initializes Service Account impersonation immediately inside ExternalAccountCredentials.__init__(), guaranteeing that cached access tokens restored across external CLI entrypoints route down to target Service Account RAB verification hooks.
  • Reorders external account constructors (aws.py, identity_pool.py) to bind custom supplier attributes prior to calling super().__init__(), preventing AttributeError crashes 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.

nbayati added 4 commits June 7, 2026 00:25
…lookup

Initialize impersonated credentials inside ExternalAccountCredentials.__init__() when an impersonation URL is set. This ensures that RAB lookup targets the Service Account endpoint.
Copy link
Copy Markdown
Contributor

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

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

@nbayati nbayati marked this pull request as ready for review June 8, 2026 19:44
@nbayati nbayati requested review from a team as code owners June 8, 2026 19:44
@nbayati nbayati requested a review from daniel-sanche June 8, 2026 19:46
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.

2 participants