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>
(cherry picked from commit
363a81ca8d0bf2f1e84b2d48aa02be40d5398147)
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)) {