]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: fetch_remote_obj() will never verify etags of encrypted objects
authorCasey Bodley <cbodley@redhat.com>
Wed, 28 Jun 2023 18:43:55 +0000 (14:43 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 28 Jun 2023 19:19:19 +0000 (15:19 -0400)
fetch_remote_obj() transfers objects in their encrypted form, so does
not have access to the decrypted data for checksum verification

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/rados/rgw_rados.cc

index b6c76831a20d3dad983ede9574e302ae1312345f..b09021379d267a08a7ddb54831cc662292d25367 100644 (file)
@@ -3386,6 +3386,7 @@ public:
 
 
   int process_attrs(void) {
+    bool encrypted = false;
     if (extra_data_bl.length()) {
       JSONParser jp;
       if (!jp.parse(extra_data_bl.c_str(), extra_data_bl.length())) {
@@ -3395,6 +3396,12 @@ public:
 
       JSONDecoder::decode_json("attrs", src_attrs, &jp);
 
+      encrypted = src_attrs.count(RGW_ATTR_CRYPT_MODE);
+      if (encrypted) {
+        // we won't have access to the decrypted data for checksumming
+        try_etag_verify = false;
+      }
+
       auto iter = src_attrs.find(RGW_ATTR_COMPRESSION);
       if (iter != src_attrs.end()) {
         const bufferlist bl = std::move(iter->second);
@@ -3437,8 +3444,8 @@ public:
       return ret;
     }
 
-    if (plugin && src_attrs.find(RGW_ATTR_CRYPT_MODE) == src_attrs.end()) {
-      //do not compress if object is encrypted
+    // do not compress if object is encrypted
+    if (plugin && !encrypted) {
       compressor = boost::in_place(cct, plugin, filter);
       // add a filter that buffers data so we don't try to compress tiny blocks.
       // libcurl reads in 16k at a time, and we need at least 64k to get a good
@@ -3448,12 +3455,7 @@ public:
       filter = &*buffering;
     }
 
-    /*
-     * Presently we don't support ETag based verification if encryption is
-     * requested. We can enable simultaneous support once we have a mechanism
-     * to know the sequence in which the filters must be applied.
-     */
-    if (try_etag_verify && src_attrs.find(RGW_ATTR_CRYPT_MODE) == src_attrs.end()) {
+    if (try_etag_verify) {
       ret = rgw::putobj::create_etag_verifier(dpp, cct, filter, manifest_bl,
                                               compression_info,
                                               etag_verifier);