]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/rest: fix url decode of post params for iam/sts/sns 55329/head
authorCasey Bodley <cbodley@redhat.com>
Fri, 26 Jan 2024 14:53:30 +0000 (09:53 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 26 Jan 2024 14:53:33 +0000 (09:53 -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>
src/rgw/rgw_rest_pubsub.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_user_policy.cc

index f43a9ef27228e8012a3d4577ca1b038a1d2ab866..611589d721f37eb57349f8578cc95d1047652fbc 100644 (file)
@@ -152,7 +152,7 @@ class RGWPSCreateTopicOp : public RGWOp {
       return -EINVAL;
     }
     // Store topic Policy.
-    policy_text = url_decode(s->info.args.get("Policy"), true);
+    policy_text = s->info.args.get("Policy");
     if (!policy_text.empty() && !get_policy_from_text(s, policy_text)) {
       return -ERR_MALFORMED_DOC;
     }
@@ -562,7 +562,7 @@ class RGWPSSetTopicAttributesOp : public RGWOp {
         return -EINVAL;
       }
     } else if (attribute_name == "Policy") {
-      policy_text = url_decode(s->info.args.get("AttributeValue"), true);
+      policy_text = s->info.args.get("AttributeValue");
       if (!policy_text.empty() && !get_policy_from_text(s, policy_text)) {
         return -ERR_MALFORMED_DOC;
       }
index 9791cab8a71e08439c6ebe0e3f29d0f54addf276..b3d3891b0ea971827e053c3994a1268a136478f9 100644 (file)
@@ -5198,8 +5198,9 @@ void parse_post_action(const std::string& post_body, req_state* s)
           if (boost::starts_with(key, "Attributes.")) {
             update_attribute_map(t, map);
           } else {
+            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 ddca86a95d86d9631c8643d9512fdb211ac11768..4103e4aff7729edabf8afe65c0d45718f99bf99c 100644 (file)
@@ -92,9 +92,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"