From 6538eb0fc9e68a743d636e50bc44dba8e7bfab5b Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Thu, 15 Feb 2024 17:20:27 -0500 Subject: [PATCH] fix: panic due to potentially uncomparable wrapped fn in express_resolve --- .changelog/4160aee8b3204fc5bb030e0f5b068f5c.json | 8 ++++++++ service/s3/express_resolve.go | 9 ++------- 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 .changelog/4160aee8b3204fc5bb030e0f5b068f5c.json 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) } }