]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: enforce BlockPublicAcls on CreateBucket
authorCasey Bodley <cbodley@redhat.com>
Tue, 1 Jul 2025 13:45:56 +0000 (09:45 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 20 May 2026 14:20:22 +0000 (10:20 -0400)
this check is unique to account-level PublicAccessBlock configuration

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

index 0e63f048ab4a48a688f906ff11fdc5e33c835d27..9809a481f905233dd24d6d24ae49b6398ac30d2a 100644 (file)
@@ -3647,6 +3647,21 @@ int RGWCreateBucket::verify_permission(optional_yield y)
     return -EACCES;
   }
 
+  // CreateBucket doesn't call rgw_build_bucket_policies() to initialize this
+  int r = read_public_access_conf(this, y, driver, s->owner.id, s->bucket_attrs,
+                                  s->public_access_block);
+  if (r < 0) {
+    return -EACCES;
+  }
+
+  // reject public canned acls
+  if (s->public_access_block.BlockPublicAcls &&
+      (s->canned_acl == "public-read" ||
+       s->canned_acl == "public-read-write" ||
+       s->canned_acl == "authenticated-read")) {
+    return -EACCES;
+  }
+
   if (object_ownership) {
     // x-amz-object-ownership requires s3:PutBucketOwnershipControls permission
     if (!verify_user_permission(this, s, arn, rgw::IAM::s3PutBucketOwnershipControls, false)) {