From cfeccfc747b9a3e63e74628be2a6cfff63dda090 Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Mon, 19 Feb 2024 18:23:07 +0100 Subject: [PATCH] rgw: return 404 on no bucket public access block Return 404 when there is no public access block on the bucket. Fixes: https://tracker.ceph.com/issues/64492 Signed-off-by: Seena Fallah (cherry picked from commit 146d4d98698d48dcbc0f036de0793e0a5f9bb8a6) --- src/rgw/rgw_common.cc | 1 + src/rgw/rgw_common.h | 1 + src/rgw/rgw_op.cc | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 125d2780183..254e9721d22 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -131,6 +131,7 @@ rgw_http_errors rgw_http_s3_errors({ { ERR_ZERO_IN_URL, {400, "InvalidRequest" }}, { ERR_NO_SUCH_TAG_SET, {404, "NoSuchTagSet"}}, { ERR_NO_SUCH_BUCKET_ENCRYPTION_CONFIGURATION, {404, "ServerSideEncryptionConfigurationNotFoundError"}}, + { ERR_NO_SUCH_PUBLIC_ACCESS_BLOCK_CONFIGURATION, {404, "NoSuchPublicAccessBlockConfiguration"}}, }); rgw_http_errors rgw_http_swift_errors({ diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index ea91859f5e6..ba3af8c8792 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -282,6 +282,7 @@ static inline const char* to_mime_type(const RGWFormat f) #define ERR_NO_SUCH_OBJECT_LOCK_CONFIGURATION 2046 #define ERR_INVALID_RETENTION_PERIOD 2047 #define ERR_NO_SUCH_BUCKET_ENCRYPTION_CONFIGURATION 2048 +#define ERR_NO_SUCH_PUBLIC_ACCESS_BLOCK_CONFIGURATION 2049 #define ERR_USER_SUSPENDED 2100 #define ERR_INTERNAL_ERROR 2200 #define ERR_NOT_IMPLEMENTED 2201 diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 445119dd4ae..ab19a15dbc5 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -8997,7 +8997,10 @@ void RGWGetBucketPublicAccessBlock::execute(optional_yield y) aiter == attrs.end()) { ldpp_dout(this, 0) << "can't find bucket IAM POLICY attr bucket_name = " << s->bucket_name << dendl; - // return the default; + + op_ret = -ERR_NO_SUCH_PUBLIC_ACCESS_BLOCK_CONFIGURATION; + s->err.message = "The public access block configuration was not found"; + return; } else { bufferlist::const_iterator iter{&aiter->second}; -- 2.39.5