Skip to content

fix(auth): avoid redundant executable run and preserve impersonated email in PluggableAuthCredentials - #14446

Open
lsirac wants to merge 8 commits into
mainfrom
fix/pluggable-auth-redundant-executable
Open

lsirac wants to merge 8 commits into
mainfrom
fix/pluggable-auth-redundant-executable

Conversation

@lsirac

@lsirac lsirac commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two issues in PluggableAuthCredentials when service account impersonation is configured:

  1. refreshAccessToken() now checks getServiceAccountImpersonationUrl() != null and delegates directly to impersonatedCredentials.refreshAccessToken(), instead of running the executable a first time on the outer credential and discarding the token.
  2. PluggableAuthCredentials.Builder(PluggableAuthCredentials) captures getServiceAccountEmail() before buildImpersonatedCredentials() clears serviceAccountImpersonationUrl on sourceCredentials, so GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL is still passed to the executable.

Testing

@lsirac
lsirac requested review from a team as code owners September 19, 2026 14:45

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

Copy link
Copy Markdown
Contributor

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 ExternalAccountCredentials and PluggableAuthCredentials to properly handle and preserve the impersonated service account email when cloning or creating scoped credentials. It introduces a lazy initializer getImpersonatedCredentials() in ExternalAccountCredentials, adds the impersonatedServiceAccountEmail field and builder methods to PluggableAuthCredentials, and overrides getServiceAccountEmail() to fall back to this email. Additionally, corresponding unit tests have been updated and added to verify that the impersonated email is correctly set in the environment and preserved during scoping. There are no review comments to address, and I have no additional feedback to provide.

@lsirac
lsirac marked this pull request as draft September 19, 2026 14:52
@lsirac
lsirac marked this pull request as ready for review September 20, 2026 00:36
@lsirac
lsirac requested a review from macastelaz September 20, 2026 00:37
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.

1 participant