Skip to content

fix(auth): Skip RAB lookup in case of non-email response from MDS.#13331

Open
vverman wants to merge 5 commits into
googleapis:regional-access-boundariesfrom
vverman:skip-rab-lookup-non-email-from-mds
Open

fix(auth): Skip RAB lookup in case of non-email response from MDS.#13331
vverman wants to merge 5 commits into
googleapis:regional-access-boundariesfrom
vverman:skip-rab-lookup-non-email-from-mds

Conversation

@vverman
Copy link
Copy Markdown
Contributor

@vverman vverman commented Jun 2, 2026

In ComputeEngineCredentials when running on GKE platform, the getAccount() call may return a value which isn't an email.

In this case the right behaviour is to skip RAB lookup which is what this PR does.

Added tests.

@vverman vverman marked this pull request as ready for review June 2, 2026 01:10
@vverman vverman requested review from a team as code owners June 2, 2026 01:10
@vverman vverman requested review from lqiu96 and nbayati June 2, 2026 01:10
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 updates ComputeEngineCredentials to return null for the Regional Access Boundary (RAB) URL if the service account is null or does not contain '@', which can happen with default service accounts in GKE environments. It also updates RegionalAccessBoundaryManager to handle a null URL gracefully, and adds a unit test to verify this behavior. There are no review comments, so I have no feedback to provide.

@vverman vverman requested a review from lqiu96 June 3, 2026 22:12
@lqiu96 lqiu96 changed the title feat: Skip RAB lookup in case of non-email response from MDS. fix(auth): Skip RAB lookup in case of non-email response from MDS. Jun 4, 2026
Comment on lines +806 to +808
// In GKE environments, the default service account might return a non-email placeholder.
// Since RAB lookup requires a valid email-based service account, we skip RAB lookup
// in non-email scenarios by returning null.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Since this is a temp change, can you link to the internal ticket tracking this (b/XXXX)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actualy isn't a temp change. MDS already returns a non-email value for certain GKE instances so this PR is actually to handle that scenario.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I meant that the skip RAB is a temp change for now. Can you link the internal tracking ticket in the PR description or as a comment in the code TODO(b/xxxx): ..?

Comment on lines +810 to +814
LoggingUtils.log(
LOGGER_PROVIDER,
Level.INFO,
Collections.emptyMap(),
"Regional Access Boundary lookup is skipped for this instance because it is a non-email instance.");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two small nits:

  1. I know the spec says 1-time INFO log (I think this should be fine given the skipRAB flag). For Java SDK, I think that might be too noisy for an internal/ hidden impl. Is it possible to change the warning level?
  2. Can we try a bit softer wording without mentioning RAB? It may be me, but lookup skipped ... non-email instance sounds a bit like an error and not super actionable for users.

Maybe something like (ff to change this to something clearer): Unable to retrieve this instance's email and will skip the regional request routing. Proceeding with request

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the log you suggested. I think the design mentions a one time INFO log hence I left that as is.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, on a second look, I think INFO with a one-time non error message is OK.

@vverman vverman requested a review from lqiu96 June 5, 2026 07:03
@lqiu96
Copy link
Copy Markdown
Member

lqiu96 commented Jun 5, 2026

Some errors in the CI:

external/com_google_api_gax_java/gax/src/main/java/com/google/api/gax/rpc/ClientContext.java:357: error: incompatible types: String cannot be converted to URI
    return ((GdchCredentials) credentials).createWithGdchAudience(audienceString);

Hmm, this may be related to some changes we made into GDCH to resolve a customer issue. Can you try and pull in the latest changes into the RAB feature branch?

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.

3 participants