-
Notifications
You must be signed in to change notification settings - Fork 863
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
Do not prioritize Default profile over environment variables #1779
Comments
Hi @joshuaflanagan, Good morning. The behavior is as expected as listed by you in the Credential and profile resolution. Any deviation in behavior could be a breaking change for other customers. I can discuss this with the development team to get their input, not sure if this would be implemented. Thanks, |
Thank you. It would be useful to get that decision documented so we can all understand why, only in .NET, the environment variable approach to configuration is disabled/broken if the user happens to have a default profile configured. |
Hi @joshuaflanagan, Just wanted to update here that I had discussion with development team. Since this is a breaking change, it would be prioritized in next major release (V4). We are unable to commit on a date though at this stage, but you will see updates on this issue as it is worked upon. Thanks, |
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue. |
Is this still on track for the v4 release? Is there an early version available to test? |
Also refer #2580 for additional scenario. |
@joshuaflanagan As of Core 3.7.108.0 we've added a new POCO called |
This does not seem like a solution at all. The desire is to be able to configure the application through environment variables without changing code. The application code should remain agnostic to where the credentials come from. That is the benefit of having the SDK use it's fallback mechanism. You can take the same application code and use it in different deployed contexts and it will find the credentials. |
Sorry for the long wait, but we just released the latest preview of V4 and the SDK now does not prioritize the default profile over environment variables anymore: https://github.com/aws/aws-sdk-net/releases/tag/4.0.0.0-preview.9 We haven't updated our developer guide page yet (https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/creds-assign.html), but this is the updated priority list: aws-sdk-net/sdk/src/Core/Amazon.Runtime/Credentials/DefaultAWSCredentialsIdentityResolver.cs Lines 50 to 58 in b4a9df9
|
Comments on closed issues are hard for our team to see. |
Description
The .NET SDK prioritizes credentials from the
default
profile over credentials set by environment variables. This is inconsistent with other language SDKs.Reproduction Steps
default
profile (add values to~/.aws/credentials
and~/.aws/config
).AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
environment variables to a different set of credentials.Expected result:
The credentials specified in step 2 are used by the process.
Actual result:
The credentials specified in the default profile are used by the process. Once a default profile is defined, the only environment variable that is respected is
AWS_PROFILE
.All other SDKs (that I examined: python, javascript) will prioritize the environment variables before looking at the profiles defined in the configuration files.
I understand that this behavior is documented, so one could argue that it "works as designed". This page clearly states the problem: https://docs.aws.amazon.com/sdk-for-net/latest/developer-guide/creds-assign.html
The item currently ranked at 4 should at least be moved down below 5 and 6, and possibly lower to make it consistent with other SDKs.
This currently leads to very confusing behavior merely by the existence of a default profile that nothing references. It is very difficult to diagnose.
Resolution
Change the fallback to the default profile to be below the attempt to load from environment variables. I'm happy to make a PR if it will be accepted. The fact that the current behavior is documented makes me think there may have been a specific decision to make the .NET SDK behave different from the others. If that is the case, I would like you to reconsider, or better explain/document the justification.
This is a 🐛 bug-report
The text was updated successfully, but these errors were encountered: