From 1605f9e14dbbe58e0b05f746dd9e2dc162e26148 Mon Sep 17 00:00:00 2001 From: Dmitry Chepurovskiy Date: Wed, 17 Feb 2021 15:04:26 +0300 Subject: [PATCH] s3: Fix shared_credentials_file auth S3 backend shared_credentials_file option wasn't working neither from config option nor from command line option. This was caused cause shared_credentials_file_provider works as part of chain provider, but in case user haven't specified access_token and access_key we had removed (set nil) to credentials field, that may contain actual credentials got from ChainProvider. AWS_SHARED_CREDENTIALS_FILE env varible as far as i understood worked, cause aws_sdk code handles it as one of default auth options, when there's not configured credentials. --- backend/s3/s3.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index ede7e2a8d..e230fc6d8 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -1559,9 +1559,6 @@ func s3Connection(ctx context.Context, opt *Options) (*s3.S3, *session.Session, if opt.EnvAuth && opt.AccessKeyID == "" && opt.SecretAccessKey == "" { // Enable loading config options from ~/.aws/config (selected by AWS_PROFILE env) awsSessionOpts.SharedConfigState = session.SharedConfigEnable - // The session constructor (aws/session/mergeConfigSrcs) will only use the user's preferred credential source - // (from the shared config file) if the passed-in Options.Config.Credentials is nil. - awsSessionOpts.Config.Credentials = nil } ses, err := session.NewSessionWithOptions(awsSessionOpts) if err != nil {