fix: update env provider to skip terminal resolver registration if asume role creds are configured - #766
Open
arandito wants to merge 1 commit into
Open
Conversation
…sume role creds are configured
jonathan343
requested changes
Aug 12, 2026
| # credential source | ||
| profile_name = setup.profile_name | ||
| if profile_name: | ||
| config = setup.config_file or await load_config() |
Contributor
There was a problem hiding this comment.
We aren't caching the config here which means we'll end up doing duplicate work. We need to ensure that we're always only reading the config file only once. Let's also keep this in mind when we integrate with @ubaskota's config resolver work.
Also, might want to make this a method on setup or some other class so we can just reuse loading caching logic.
Contributor
There was a problem hiding this comment.
I'm just now realizing that when a customer attempts to use the assume role provider and doesn't install aws-credentials-sts, they don't get a helpful error message. They just get:
smithy_aws_core.identity.chain.exceptions.IdentityChainError: No credential providers were configured to resolve an identity.
Not sure if this is another gap in the SEP or a miss on our end. Can you look into this?
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
The
EnvironmentCredentialsProviderpreviously registered a terminal resolver wheneverAWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYwere present in the environment. This short-circuited the credential chain even when the active profile was configured to assume a role using those environment credentials as the source, meaning the source credentials were handed back directly instead of being used to make the AssumeRole call.This change makes the provider skip registering a terminal
EnvironmentCredentialsResolverwhen a profile is explicitly configure inIdentityChain.create()and that profile declares bothrole_arnandcredential_source = Environment, deferring to assume-role resolution.Example profile that triggers the skip (
~/.aws/config):With this profile, the environment credentials are treated as the source for the AssumeRole call rather than the credentials to return.
Testing
test_environment.py:make test-py- 1881 passed, 9 skipped.make check-py- ruff, format, and pyright all clean.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.