From: Adam C. Emerson Date: Wed, 27 Sep 2017 20:08:56 +0000 (-0400) Subject: rgw: Check bucket GetBucketLocation in policy X-Git-Tag: v13.0.1~755^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=79188d679edeb6e2f7ca852fdc4224368412cb72;p=ceph.git rgw: Check bucket GetBucketLocation in policy Add code to check s3:GetBucketLocation against bucket policy. Fixes: http://tracker.ceph.com/issues/21582 Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1493934 Signed-off-by: Adam C. Emerson --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 39a5dee9b715..1cfd62530d04 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -2304,11 +2304,16 @@ int RGWGetBucketLogging::verify_permission() int RGWGetBucketLocation::verify_permission() { - if (false == s->auth.identity->is_owner_of(s->bucket_owner.get_id())) { - return -EACCES; + if (s->iam_policy) { + if (s->iam_policy->eval(s->env, *s->auth.identity, + rgw::IAM::s3GetBucketLocation, + ARN(s->bucket)) == Effect::Allow) { + return 0; + } + } else if (s->auth.identity->is_owner_of(s->bucket_owner.get_id())) { + return 0; } - - return 0; + return -EACCES; } int RGWCreateBucket::verify_permission()