Skip to content

Commit 373d638

Browse files
committed
rgw/s3: reject PutBucket/ObjectAcl for BucketOwnerEnforced
Signed-off-by: Casey Bodley <[email protected]>
1 parent 0b05b34 commit 373d638

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/rgw/rgw_common.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ rgw_http_errors rgw_http_s3_errors({
144144
{ ECANCELED, {409, "ConcurrentModification"}},
145145
{ EDQUOT, {507, "InsufficientCapacity"}},
146146
{ ENOSPC, {507, "InsufficientCapacity"}},
147+
{ ERR_ACLS_NOT_SUPPORTED, {400, "AccessControlListNotSupported"}},
147148
});
148149

149150
rgw_http_errors rgw_http_swift_errors({

src/rgw/rgw_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ inline constexpr const char* RGW_REST_STS_XMLNS =
352352
#define ERR_PRESIGNED_URL_DISABLED 2224
353353
#define ERR_AUTHORIZATION 2225 // SNS 403 AuthorizationError
354354
#define ERR_ILLEGAL_LOCATION_CONSTRAINT_EXCEPTION 2226
355+
#define ERR_ACLS_NOT_SUPPORTED 2227 // 400 AccessControlListNotSupported
355356

356357
#define ERR_BUSY_RESHARDING 2300 // also in cls_rgw_types.h, don't change!
357358
#define ERR_NO_SUCH_ENTITY 2301

src/rgw/rgw_op.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6302,6 +6302,12 @@ void RGWDeleteLC::pre_exec()
63026302

63036303
void RGWPutACLs::execute(optional_yield y)
63046304
{
6305+
if (s->bucket_object_ownership == rgw::s3::ObjectOwnership::BucketOwnerEnforced) {
6306+
s->err.message = "Cannot set ACLs when ObjectOwnership is BucketOwnerEnforced.";
6307+
op_ret = -ERR_ACLS_NOT_SUPPORTED;
6308+
return;
6309+
}
6310+
63056311
const RGWAccessControlPolicy& existing_policy = \
63066312
(rgw::sal::Object::empty(s->object.get()) ? s->bucket_acl : s->object_acl);
63076313

0 commit comments

Comments
 (0)