]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/rest: fix url decode of post params for iam/sts/sns 55357/head
authorCasey Bodley <cbodley@redhat.com>
Fri, 26 Jan 2024 14:53:30 +0000 (09:53 -0500)
committerCasey Bodley <cbodley@redhat.com>
Mon, 29 Jan 2024 16:44:47 +0000 (11:44 -0500)
add the `in_query=true` argument to `url_decode()` to replace '+' with ' '

Fixes: https://tracker.ceph.com/issues/64189
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 4bdc5d18dd68b95c6ccd4c0e77a1bd04ad86dbb8)

Conflicts:
src/rgw/rgw_rest_pubsub.cc no topic policy or SetTopicAttributes
src/rgw/rgw_rest_s3.cc no parse_post_action() from fbbc52aecf3548706b8d5ff49a57200aebc03d54

src/rgw/rgw_rest_iam.cc
src/rgw/rgw_rest_pubsub.cc
src/rgw/rgw_rest_sts.cc
src/rgw/rgw_rest_user_policy.cc

index f63018d189b3b9dd723e68dc8a5f15ca661ec5d2..b31697a860aff9522d23e12bf2e3d49fb7aefbc6 100644 (file)
@@ -30,8 +30,9 @@ void RGWHandler_REST_IAM::rgw_iam_parse_input()
       for (const auto& t : tokens) {
         auto pos = t.find("=");
         if (pos != string::npos) {
+          constexpr bool in_query = true; // replace '+' with ' '
           s->info.args.append(t.substr(0,pos),
-                              url_decode(t.substr(pos+1, t.size() -1)));
+                              url_decode(t.substr(pos+1, t.size() -1), in_query));
         }
       }
     }
index c20cbe7c2333e14f8712f492a474d1a4a5048f2e..6a0d1f8703f4356b4fff65c8de96cf5d423f6bdc 100644 (file)
@@ -358,7 +358,8 @@ void RGWHandler_REST_PSTopic_AWS::rgw_topic_parse_input() {
           if (key == "Action") {
             s->info.args.append(key, t.substr(pos + 1, t.size() - 1));
           } else if (key == "Name" || key == "TopicArn") {
-            const auto value = url_decode(t.substr(pos + 1, t.size() - 1));
+            constexpr bool in_query = true; // replace '+' with ' '
+            const auto value = url_decode(t.substr(pos + 1, t.size() - 1), in_query);
             s->info.args.append(key, value);
           } else {
             update_attribute_map(t, map);
index 093c92d3633ea5e2c5d16eb4a67e9dc6ffc6d0eb..fcd2f8028f61a45a863e468f65740b39788b015b 100644 (file)
@@ -759,8 +759,9 @@ void RGWHandler_REST_STS::rgw_sts_parse_input()
       for (const auto& t : tokens) {
         auto pos = t.find("=");
         if (pos != string::npos) {
+          constexpr bool in_query = true; // replace '+' with ' '
           s->info.args.append(t.substr(0,pos),
-                              url_decode(t.substr(pos+1, t.size() -1)));
+                              url_decode(t.substr(pos+1, t.size() -1), in_query));
         }
       }
     }
index f6c7d2314dc09fb4f013cf340fd6eb8cd8c3c553..d4b29679c72e982bd97a2e3a960a531924e6e59f 100644 (file)
@@ -93,9 +93,9 @@ uint64_t RGWPutUserPolicy::get_op()
 
 int RGWPutUserPolicy::get_params()
 {
-  policy_name = url_decode(s->info.args.get("PolicyName"), true);
-  user_name = url_decode(s->info.args.get("UserName"), true);
-  policy = url_decode(s->info.args.get("PolicyDocument"), true);
+  policy_name = s->info.args.get("PolicyName");
+  user_name = s->info.args.get("UserName");
+  policy = s->info.args.get("PolicyDocument");
 
   if (policy_name.empty() || user_name.empty() || policy.empty()) {
     ldpp_dout(this, 20) << "ERROR: one of policy name, user name or policy document is empty"