Skip to content

feat: Skip RAB lookup in case of non-email response from MDS.#13331

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

feat: Skip RAB lookup in case of non-email response from MDS.#13331
vverman wants to merge 2 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.

// 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.
if (account == null || !account.contains("@")) {
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.

I know the document may have changed since this PR was raised, but I think the the standard email pattern is a regex and we will need to confirm to that.

Comment on lines +807 to +809
if (account == null || !account.contains("@")) {
return null;
}
Copy link
Copy Markdown
Member

@lqiu96 lqiu96 Jun 3, 2026

Choose a reason for hiding this comment

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

I think we will also need to follow the recommendation for a one-time log message that the RAB instance is skipped (maybe here, maybe in the RABManager)

Comment on lines +199 to +202
if (url == null) {
future.set(null);
return;
}
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.

qq, can you remind me again why we need to do future.set(null);?

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