From: Casey Bodley Date: Tue, 1 Jul 2025 13:45:56 +0000 (-0400) Subject: rgw: enforce BlockPublicAcls on CreateBucket X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8566ec987c7f5599eb14a0dd194e0d1828eb6e80;p=ceph.git rgw: enforce BlockPublicAcls on CreateBucket this check is unique to account-level PublicAccessBlock configuration Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 0e63f048ab4a..9809a481f905 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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)) {