]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/crypt - fix sse-s3 logic.
authorMarcus Watts <mwatts@redhat.com>
Fri, 28 Jan 2022 10:32:14 +0000 (05:32 -0500)
committerMarcus Watts <mwatts@redhat.com>
Tue, 19 Apr 2022 21:35:40 +0000 (17:35 -0400)
The previous logic path was overly eager to do sse-s3.  This version
ensures that the "no-encryption" case does not default to sse-s3.
It also removes some argument sanity checking which is now down before
this code is reached.

Signed-off-by: Marcus Watts <mwatts@redhat.com>
src/rgw/rgw_crypt.cc

index 22a2e2e3ce18bebeb755e8f64641c7ccf46bdd73..767e995ed60a9b9057637c59791a80e0aee9f8e4 100644 (file)
@@ -1189,17 +1189,8 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
         return -EINVAL;
       }
     } else {
-      /* x-amz-server-side-encryption not present or empty */
-      std::string_view key_id =
-       crypt_attributes.get(X_AMZ_SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID);
-      if (!key_id.empty()) {
-        ldpp_dout(s, 5) << "ERROR: SSE-KMS encryption request is missing the header "
-                         << "x-amz-server-side-encryption"
-                         << dendl;
-        s->err.message = "Server Side Encryption with KMS managed key requires "
-                         "HTTP header x-amz-server-side-encryption : aws:kms";
-        return -EINVAL;
-      }
+  /*no encryption*/
+      return 0;
     }
 
     /* from here on we are only handling SSE-S3 (req_sse=="AES256") */
@@ -1289,9 +1280,10 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
       ::ceph::crypto::zeroize_for_security(actual_key, sizeof(actual_key));
       return 0;
     }
+    s->err.message = "Request specifies Server Side Encryption "
+                     "but server configuration does not support this.";
+    return -EINVAL;
   }
-  /*no encryption*/
-  return 0;
 }