From 0cfcc08be19e0eb21dfaee425765bc7a2995ff0e 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 771ea07d4..4ac6311df 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -1559,9 +1559,6 @@ func s3Connection(ctx context.Context, opt *Options, client *http.Client) (*s3.S 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 {