Skip to content

Commit 56bf507

Browse files
cbodleymattbenjamin
authored andcommitted
rgw: GetObjAttrs calls rgw_s3_prepare_decrypt()
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 <[email protected]>
1 parent 1be4399 commit 56bf507

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/rgw/rgw_op.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,8 +2375,7 @@ void RGWGetObj::execute(optional_yield y)
23752375
goto done_err;
23762376

23772377
/* STAT ops don't need data, and do no i/o */
2378-
if ((get_type() == RGW_OP_STAT_OBJ) ||
2379-
(get_type() == RGW_OP_GET_OBJ_ATTRS)) {
2378+
if (get_type() == RGW_OP_STAT_OBJ) {
23802379
return;
23812380
}
23822381
if (s->info.env->exists("HTTP_X_RGW_AUTH")) {

src/rgw/rgw_rest_s3.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3858,6 +3858,21 @@ int RGWGetObjAttrs_ObjStore_S3::get_params(optional_yield y)
38583858
return 0;
38593859
} /* RGWGetObjAttrs_ObjStore_S3::get_params(...) */
38603860

3861+
int RGWGetObjAttrs_ObjStore_S3::get_decrypt_filter(
3862+
std::unique_ptr<RGWGetObj_Filter> *filter,
3863+
RGWGetObj_Filter* cb, bufferlist* manifest_bl)
3864+
{
3865+
// we aren't actually decrypting the data, but for objects encrypted with
3866+
// SSE-C we do need to verify that required headers are present and valid
3867+
//
3868+
// in the SSE-KMS and SSE-S3 cases, this unfortunately causes us to fetch
3869+
// decryption keys which we don't need :(
3870+
std::unique_ptr<BlockCrypt> block_crypt; // ignored
3871+
std::map<std::string, std::string> crypt_http_responses; // ignored
3872+
return rgw_s3_prepare_decrypt(s, s->yield, attrs, &block_crypt,
3873+
crypt_http_responses);
3874+
}
3875+
38613876
void RGWGetObjAttrs_ObjStore_S3::send_response()
38623877
{
38633878
if (op_ret)

src/rgw/rgw_rest_s3.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ class RGWGetObjAttrs_ObjStore_S3 : public RGWGetObjAttrs_ObjStore {
380380
~RGWGetObjAttrs_ObjStore_S3() override {}
381381

382382
int get_params(optional_yield y) override;
383+
int get_decrypt_filter(std::unique_ptr<RGWGetObj_Filter>* filter,
384+
RGWGetObj_Filter* cb,
385+
bufferlist* manifest_bl) override;
383386
void send_response() override;
384387
};
385388

0 commit comments

Comments
 (0)