fix(aws-secrets): resolve named profiles via full node provider chain#773
Merged
Conversation
`@initAws(profile=...)` used `fromIni({ profile })`, which does not fully
resolve `credential_source` entries in `~/.aws/config` (e.g. `EcsContainer`,
`Ec2InstanceMetadata`). Profiles backed by container/instance roles — such as
CodeBuild's `credential_source = EcsContainer` — therefore failed with an
authentication error even though the same profile works with the AWS CLI.
Switch to `fromNodeProviderChain({ profile })`, which scopes resolution to the
named profile while delegating to the container/instance-metadata providers,
matching the AWS CLI and SDK default credential resolution.
Fixes #772
Contributor
|
The changes in this PR will be included in the next version bump.
|
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.


Summary
Fixes #772.
@initAws(profile=...)resolved credentials withfromIni({ profile }), which does not fully handlecredential_sourceentries in~/.aws/config(e.g.EcsContainer,Ec2InstanceMetadata). Profiles backed by container/instance roles — like CodeBuild'scredential_source = EcsContaineron AWS GovCloud — failed withAuthentication failed with provided credentials, even though the same profile works with the AWS CLI and the SDK's default credential chain.Change
Switch the profile branch in
getCredentials()fromfromInitofromNodeProviderChain({ profile }). This scopes resolution to the named profile while delegating to the container/instance-metadata providers, matching the behavior of the AWS CLI and the SDK's default credential resolution.Notes
fromNodeProviderChainaccepts the sameprofileinit property and respects it, so explicit/OIDC/default-chain code paths are unchanged.@varlock/aws-secrets-plugin.typecheck,build, andlintpass. No existing unit tests for this plugin to update.🤖 Generated with Claude Code