]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: GetObjAttrs calls rgw_s3_prepare_decrypt()
authorCasey Bodley <cbodley@redhat.com>
Thu, 17 Oct 2024 23:25:57 +0000 (19:25 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Wed, 8 Jan 2025 00:17:27 +0000 (19:17 -0500)
RGWGetObj::execute() relies on the virtual get_decrypt_filter() which is
overridden by RGWGetObj_ObjStore_S3

but when called from RGWGetObjAttrs_ObjStore_S3, there is no override.
add one that just calls rgw_s3_prepare_decrypt()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_op.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_s3.h

index 866b959e3ac9cc27b31fc610eb72cab13c4f27cc..62fc6a285a7f1186bce364a5c29a578c775e18e0 100644 (file)
@@ -2375,8 +2375,7 @@ void RGWGetObj::execute(optional_yield y)
     goto done_err;
 
   /* STAT ops don't need data, and do no i/o */
-  if ((get_type() == RGW_OP_STAT_OBJ) ||
-      (get_type() == RGW_OP_GET_OBJ_ATTRS)) {
+  if (get_type() == RGW_OP_STAT_OBJ) {
     return;
   }
   if (s->info.env->exists("HTTP_X_RGW_AUTH")) {
index 234c26abbda2e76cb939ce00c0009d079c57ee8d..698917f95f856ddbeb4a1e59f3fe2dfb22ca87eb 100644 (file)
@@ -3858,6 +3858,21 @@ int RGWGetObjAttrs_ObjStore_S3::get_params(optional_yield y)
   return 0;
 } /* RGWGetObjAttrs_ObjStore_S3::get_params(...) */
 
+int RGWGetObjAttrs_ObjStore_S3::get_decrypt_filter(
+    std::unique_ptr<RGWGetObj_Filter> *filter,
+    RGWGetObj_Filter* cb, bufferlist* manifest_bl)
+{
+  // we aren't actually decrypting the data, but for objects encrypted with
+  // SSE-C we do need to verify that required headers are present and valid
+  //
+  // in the SSE-KMS and SSE-S3 cases, this unfortunately causes us to fetch
+  // decryption keys which we don't need :(
+  std::unique_ptr<BlockCrypt> block_crypt; // ignored
+  std::map<std::string, std::string> crypt_http_responses; // ignored
+  return rgw_s3_prepare_decrypt(s, s->yield, attrs, &block_crypt,
+                                crypt_http_responses);
+}
+
 void RGWGetObjAttrs_ObjStore_S3::send_response()
 {
   if (op_ret)
index 37dbf90f203c0ca66f0988a3c179890739c7faa2..e8fdc69751c41a9570c3a081f0c8e51bbfeb145b 100644 (file)
@@ -380,6 +380,9 @@ public:
   ~RGWGetObjAttrs_ObjStore_S3() override {}
 
   int get_params(optional_yield y) override;
+  int get_decrypt_filter(std::unique_ptr<RGWGetObj_Filter>* filter,
+                         RGWGetObj_Filter* cb,
+                         bufferlist* manifest_bl) override;
   void send_response() override;
 };