]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: read_obj_policy() consults s3:prefix when deciding between 403/404 68577/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 23 Apr 2026 15:53:16 +0000 (11:53 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 23 Apr 2026 15:53:18 +0000 (11:53 -0400)
when read_obj_policy() gets ENOENT, it only returns 404 NoSuchKey if the
requester has s3:ListBucket permission. however, policy that allows
s3:ListBucket may be conditional on the s3:prefix to restrict listings
to certain paths/object names. add the requested object name to the iam
environment as s3:prefix to match aws behavior here

Fixes: https://tracker.ceph.com/issues/74398
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_op.cc

index d75a67aeac92f0f1cfc17ba1109bcb039f312bc3..d26ea5be29e84feab92e8f61f33801ec3ddf2d1c 100644 (file)
@@ -475,6 +475,8 @@ static int read_obj_policy(const DoutPrefixProvider *dpp,
       return -ENOENT;
     }
 
+    s->env.emplace("s3:prefix", object->get_name());
+
     if (verify_bucket_permission(dpp, s, bucket->get_key(), s->user_acl,
                                  bucket_policy, policy, s->iam_identity_policies,
                                  s->session_policies, rgw::IAM::s3ListBucket)) {