diff --git a/.changelog/4160aee8b3204fc5bb030e0f5b068f5c.json b/.changelog/4160aee8b3204fc5bb030e0f5b068f5c.json new file mode 100644 index 00000000000..3a01ae2b3a2 --- /dev/null +++ b/.changelog/4160aee8b3204fc5bb030e0f5b068f5c.json @@ -0,0 +1,8 @@ +{ + "id": "4160aee8-b320-4fc5-bb03-0e0f5b068f5c", + "type": "bugfix", + "description": "Prevent potential panic caused by invalid comparison of credentials.", + "modules": [ + "service/s3" + ] +} \ No newline at end of file diff --git a/service/s3/express_resolve.go b/service/s3/express_resolve.go index 18d6c06ada0..7c7a7b42400 100644 --- a/service/s3/express_resolve.go +++ b/service/s3/express_resolve.go @@ -24,14 +24,9 @@ func finalizeExpressCredentials(o *Options, c *Client) { } // Operation config finalizer: update the sigv4 credentials on the default -// express provider if it changed to ensure different cache keys +// express provider in case it changed to ensure different cache keys func finalizeOperationExpressCredentials(o *Options, c Client) { - p, ok := o.ExpressCredentials.(*defaultS3ExpressCredentialsProvider) - if !ok { - return - } - - if c.options.Credentials != o.Credentials { + if p, ok := o.ExpressCredentials.(*defaultS3ExpressCredentialsProvider); ok { o.ExpressCredentials = p.CloneWithBaseCredentials(o.Credentials) } }