Skip to content

Commit ea45da7

Browse files
committed
rgw: fetch_remote_obj() will never verify etags of encrypted objects
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 <[email protected]>
1 parent 8d35759 commit ea45da7

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3386,6 +3386,7 @@ class RGWRadosPutObj : public RGWHTTPStreamRWRequest::ReceiveCB
33863386

33873387

33883388
int process_attrs(void) {
3389+
bool encrypted = false;
33893390
if (extra_data_bl.length()) {
33903391
JSONParser jp;
33913392
if (!jp.parse(extra_data_bl.c_str(), extra_data_bl.length())) {
@@ -3395,6 +3396,12 @@ class RGWRadosPutObj : public RGWHTTPStreamRWRequest::ReceiveCB
33953396

33963397
JSONDecoder::decode_json("attrs", src_attrs, &jp);
33973398

3399+
encrypted = src_attrs.count(RGW_ATTR_CRYPT_MODE);
3400+
if (encrypted) {
3401+
// we won't have access to the decrypted data for checksumming
3402+
try_etag_verify = false;
3403+
}
3404+
33983405
auto iter = src_attrs.find(RGW_ATTR_COMPRESSION);
33993406
if (iter != src_attrs.end()) {
34003407
const bufferlist bl = std::move(iter->second);
@@ -3437,8 +3444,8 @@ class RGWRadosPutObj : public RGWHTTPStreamRWRequest::ReceiveCB
34373444
return ret;
34383445
}
34393446

3440-
if (plugin && src_attrs.find(RGW_ATTR_CRYPT_MODE) == src_attrs.end()) {
3441-
//do not compress if object is encrypted
3447+
// do not compress if object is encrypted
3448+
if (plugin && !encrypted) {
34423449
compressor = boost::in_place(cct, plugin, filter);
34433450
// add a filter that buffers data so we don't try to compress tiny blocks.
34443451
// libcurl reads in 16k at a time, and we need at least 64k to get a good
@@ -3448,12 +3455,7 @@ class RGWRadosPutObj : public RGWHTTPStreamRWRequest::ReceiveCB
34483455
filter = &*buffering;
34493456
}
34503457

3451-
/*
3452-
* Presently we don't support ETag based verification if encryption is
3453-
* requested. We can enable simultaneous support once we have a mechanism
3454-
* to know the sequence in which the filters must be applied.
3455-
*/
3456-
if (try_etag_verify && src_attrs.find(RGW_ATTR_CRYPT_MODE) == src_attrs.end()) {
3458+
if (try_etag_verify) {
34573459
ret = rgw::putobj::create_etag_verifier(dpp, cct, filter, manifest_bl,
34583460
compression_info,
34593461
etag_verifier);

0 commit comments

Comments
 (0)