From 958a480e5397a47409dc0c829e70767d28190427 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Thu, 13 Apr 2023 08:10:57 -0700 Subject: [PATCH] fix: lambda function expiration when cred.Expiration is set (#17029) --- cmd/object-lambda-handlers.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/object-lambda-handlers.go b/cmd/object-lambda-handlers.go index ccbe6c621..fe97cc6ed 100644 --- a/cmd/object-lambda-handlers.go +++ b/cmd/object-lambda-handlers.go @@ -46,8 +46,9 @@ func getLambdaEventData(bucket, object string, cred auth.Credentials, r *http.Re secure = globalMinioEndpointURL.Scheme == "https" } - duration := time.Since(cred.Expiration) - if cred.Expiration.IsZero() { + duration := time.Until(cred.Expiration) + if cred.Expiration.IsZero() || duration > time.Hour { + // Always limit to 1 hour. duration = time.Hour }