Skip to content

feat(auth): add AWS security credentials supplier support#5595

Open
Linkgoron wants to merge 1 commit intogoogleapis:mainfrom
Linkgoron:feat-auth-aws-security-credentials-supplier
Open

feat(auth): add AWS security credentials supplier support#5595
Linkgoron wants to merge 1 commit intogoogleapis:mainfrom
Linkgoron:feat-auth-aws-security-credentials-supplier

Conversation

@Linkgoron
Copy link
Copy Markdown

This PR adds a programmatic AWS external account builder that accepts caller-provided AWS region and security credentials. This lets applications delegate AWS credential resolution to the AWS SDK while google-cloud-auth builds the AWS subject token and performs the Google token exchange.

This, hopefully, adds similar behavior to the ones that already exist in the Go, Python or Node SDKs.

Also add supplier-path tests and censor sensitive AWS credential fields in Debug output.

@Linkgoron Linkgoron requested review from a team as code owners May 6, 2026 07:23
@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 6, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown

@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 introduces support for AWS Workload Identity Federation by adding the AwsSecurityCredentialsSupplier trait and the AwsExternalAccountBuilder. It refactors the existing AWS credential resolution logic to support custom suppliers and includes new tests for these features. Review feedback suggests deriving Debug for the new builder to maintain consistency with repository style guides and recommends addressing an inconsistency in ProgrammaticBuilder regarding universe_domain handling.

Comment thread src/auth/src/credentials/external_account.rs
Comment on lines +2075 to +2078
assert_eq!(
config.service_account_impersonation_url,
Some("https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/test-principal:generateAccessToken".to_string())
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This test codifies an inconsistency where ProgrammaticBuilder ignores the universe_domain when generating the service account impersonation URL. While AwsExternalAccountBuilder correctly respects the universe domain (as seen in the test at line 2137), ProgrammaticBuilder::with_target_principal hardcodes googleapis.com. To fix this, ProgrammaticBuilder should be updated to use the deferred resolution logic now available in ExternalAccountConfigBuilder::with_target_principal. Note that per repository rules, a feature does not have to be fully implemented in a single pull request if the remaining work is documented in the PR description or as a TODO comment in the code.

References
  1. A feature does not have to be fully implemented in a single pull request if the remaining work is documented in the PR description or as a TODO comment in the code, allowing for continuous improvement.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is true, the problem here is that I didn't want to change existing behavior, just add my enhancement. if it's fine that this PR also fixes this bug - I can fix this. Or is the issue just the existence of the test?

Add a programmatic AWS external account builder that accepts caller-provided AWS region and security credentials. This lets applications delegate AWS credential resolution to the AWS SDK while google-cloud-auth builds the AWS subject token and performs the Google token exchange.

Also add supplier-path tests and censor sensitive AWS credential fields in Debug output.
@Linkgoron Linkgoron force-pushed the feat-auth-aws-security-credentials-supplier branch from 493ed55 to f11f06e Compare May 6, 2026 07: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.

1 participant