profile credentials provider should support sts web identity as well#298
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #298 +/- ##
==========================================
+ Coverage 81.72% 81.91% +0.19%
==========================================
Files 36 36
Lines 7134 7144 +10
==========================================
+ Hits 5830 5852 +22
+ Misses 1304 1292 -12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TingDaoK
marked this pull request as ready for review
July 7, 2026 23:09
azkrishpy
approved these changes
Jul 9, 2026
azkrishpy
left a comment
Contributor
There was a problem hiding this comment.
nit: seems like we have a convention of getting the different profile properties at the beginning.
Since we might be adding other providers to this profile soon might be better to make it an else if
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes:
The profile credentials provider (
aws_credentials_provider_new_profile) now supportsweb_identity_token_fileas a credential source whenrole_arnis present but neithersource_profilenorcredential_sourceis specified.Previously,
s_create_sts_based_provideronly handled two credential source paths for assume-role operations:source_profile— resolve credentials from another profilecredential_source— resolve from environment (Ec2InstanceMetadata, Environment, EcsContainer)If neither was set, the function returned NULL even when
web_identity_token_filewas configured in the profile. This broke common EKS/IRSA configurations where a profile chains through a web identity token:This PR adds a third branch: when
role_arnis present and neithersource_profilenorcredential_sourceis set, check forweb_identity_token_fileand create anaws_credentials_provider_new_sts_web_identityprovider as the credential source for the STS assume-role call.Additional changes:
s_aws_http_stream_activate_mockrather than froms_aws_http_connection_make_request_mock, ensuring callbacks fire after stream activation (matches real HTTP client behavior)s_create_sts_based_providerands_credentials_provider_new_profile_internalTesting:
credentials_provider_profile_with_web_identity_config— single profile withrole_arn+web_identity_token_file(no source_profile), exercises the new code path through the profile providercredentials_provider_sts_from_profile_config_with_web_identity_source— two-hop chain wheredefaultusessource_profilepointing toirsa-hop1which hasrole_arn+web_identity_token_fileBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.