]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
SignatureDoesNotMatch for certain RGW Admin Ops endpoints when using v4 auth
authorDavid.Hall <mcfadden7586@gmail.com>
Fri, 8 Sep 2023 20:12:49 +0000 (15:12 -0500)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Tue, 5 Dec 2023 19:50:46 +0000 (02:50 +0700)
https://tracker.ceph.com/issues/62105
Change from std::map<> to std::multimap<> to allow for duplicates
rgwadmin submits duplicates in a very few cases, so we need to handle them.

Signed-off-by: David.Hall <mcfadden7586@gmail.com>
(cherry picked from commit 3758f6e7433c58b9e62ae35184659cffabdbd133)

src/rgw/rgw_auth_s3.cc

index 0797f8184aad8790d2023e3b579e5c50fc310ae3..dcd29bfca2b2a9b5421288aeff50d2c83f9dd4d4 100644 (file)
@@ -574,7 +574,7 @@ std::string get_v4_canonical_qs(const req_info& info, const bool using_qs)
 
   /* Handle case when query string exists. Step 3 described in: http://docs.
    * aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html */
-  std::map<std::string, std::string> canonical_qs_map;
+  std::multimap<std::string, std::string> canonical_qs_map;
   for (const auto& s : get_str_vec<5>(*params, "&")) {
     std::string_view key, val;
     const auto parsed_pair = parse_key_value(s);
@@ -595,7 +595,7 @@ std::string get_v4_canonical_qs(const req_info& info, const bool using_qs)
     // while awsv4 specs ask for all slashes to be encoded, s3 itself is relaxed
     // in its implementation allowing non-url-encoded slashes to be present in
     // presigned urls for instance
-    canonical_qs_map[aws4_uri_recode(key, true)] = aws4_uri_recode(val, true);
+    canonical_qs_map.insert({{aws4_uri_recode(key, true), aws4_uri_recode(val, true)}});
   }
 
   /* Thanks to the early exist we have the guarantee that canonical_qs_map has