-
Notifications
You must be signed in to change notification settings - Fork 870
Description
Describe the bug
Certain overloads of AmazonS3Client constructor accept both login/password (awsAccessKeyId/awsSecretAccessKey) and an instance of AmazonS3Config object.
Down the call chain, in AmazonServiceClient, the config object is modified by overwriting DefaultAWSCredentials:
if(credentials != null) config.DefaultAWSCredentials = credentials;
If several instances of AmazonS3Client are created with same config instance but different credentials, previously set credentials will be overwritten by latest call.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
Common expectation is that config object created by the user code should not be modified by the library code.
Current Behavior
Config object created by the user code is modified by the library code, causing confusion.
Reproduction Steps
`
var config = new AmazonS3Config();
var client1 = new AmazonS3Client(username1, password1, config);
var client2 = new AmazonS3Client(username2, password2, config);
// client1 now inadvertently uses username2/password2
`
Possible Solution
Save login/password independently from configuration or create private copy of configuration object.
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.S3 4.0.4.2, but current code in main is still affected
Targeted .NET Platform
All
Operating System and version
All