]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: return 404 on no bucket public access block
authorSeena Fallah <seenafallah@gmail.com>
Mon, 19 Feb 2024 17:23:07 +0000 (18:23 +0100)
committerCasey Bodley <cbodley@redhat.com>
Thu, 7 Mar 2024 16:12:54 +0000 (11:12 -0500)
Return 404 when there is no public access block on the bucket.

Fixes: https://tracker.ceph.com/issues/64492
Signed-off-by: Seena Fallah <seenafallah@gmail.com>
(cherry picked from commit 146d4d98698d48dcbc0f036de0793e0a5f9bb8a6)

src/rgw/rgw_common.cc
src/rgw/rgw_common.h
src/rgw/rgw_op.cc

index 125d2780183870d4c4716b1e53f5587007487aae..254e9721d22227d370cfea006977a00769f20488 100644 (file)
@@ -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({
index ea91859f5e6823bd7223bb74a23a1c4b7cdfc00f..ba3af8c87929325a4431b143ced6811be26f26d8 100644 (file)
@@ -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
index 445119dd4aee7b0d69c90cb5526b98a88ecb08df..ab19a15dbc5835f8a93e4934b2f8a67ffdc86ce8 100644 (file)
@@ -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};