From 9a4fbf99618d9b5426e968b0965aa4f36623a768 Mon Sep 17 00:00:00 2001 From: barryhunter Date: Mon, 9 Nov 2020 13:48:44 +0000 Subject: [PATCH] Need to sort url parameters, in V4 Signature Found this fork that adds V4 verification - which is great. But run into problem, found the URL params needs to be sorted (eg when runing ListObjects on a bucket, it adds multiple when using delimiter+prefix for example) https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html Thought worth pushing this upstream. This is the same change made in our copy https://github.com/geograph-project/geograph-project/commit/466592a154069ccb92898a8f992d62b61034cc57 --- S3.php | 1 + 1 file changed, 1 insertion(+) diff --git a/S3.php b/S3.php index 391a1e2a..a4a49eda 100644 --- a/S3.php +++ b/S3.php @@ -2040,6 +2040,7 @@ public static function __getSignatureV4($aHeaders, $headers, $method='GET', $uri if (strpos($uri, '?')) { list ($uri, $query_str) = @explode("?", $uri); parse_str($query_str, $parameters); + ksort($parameters); //parameters need to be in sorted order } // CanonicalRequests