-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default authentication flow should fail if invalid profile name is passed #2058
Comments
Hi @gdavison , Thanks for opening the issue. I'm able to reproduce the error. I believe this is happening because the ResolveCredentialsFromProfile function does not have a case handling loading of non-existent profiles, and falls back to
I'll mark it |
FYI we've decided that this is safe to do by default since the caller is explicitly asking for something that isn't in their config. Additionally the only "success" scenario here with the current behavior would be if you happen to have IMDS available beyond the misconfiguration, which we think is both unlikely and also probably not desired. |
|
Describe the bug
When the default authentication flow is used with
config.LoadDefaultConfig()
, providing an invalid profile name, either withconfig.WithSharedConfigProfile()
or by settingAWS_PROFILE
, does not cause an error, but falls back to trying IMDS.Previously reported as #1591, but the proposed fix did not resolve the issue
Expected Behavior
In the AWS CLI, I get
The SDK should fail with a
config.SharedConfigProfileNotExistError
error, or at least have the option to do so.Current Behavior
The AWS SDK falls back to calling IMDS
Reproduction Steps
and set
AWS_PROFILE
to an invalid profile nameor
Possible Solution
No response
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
github.com/aws/aws-sdk-go-v2 v1.13.0, github.com/aws/aws-sdk-go-v2/config v1.13.1
and
github.com/aws/aws-sdk-go-v2 v1.17.6, github.com/aws/aws-sdk-go-v2/config v1.18.18
Compiler and Version used
go version go1.20.2 darwin/arm64
Operating System and version
N/A
The text was updated successfully, but these errors were encountered: