rgw: reject unauthenticated response-header actions
authorMatt Benjamin <mbenjamin@redhat.com>
Fri, 27 Mar 2020 17:13:48 +0000 (18:13 +0100)
committerBastien Roucariès <rouca@debian.org>
Sat, 21 Oct 2023 16:42:26 +0000 (17:42 +0100)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Reviewed-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)

Origin: upstream, https://github.com/ceph/ceph/pull/34504/commits/ba0790a01ba5252db1ebc299db6e12cd758d0ff9

Gbp-Pq: Name CVE-2020-1760-1.patch

src/rgw/rgw_rest_s3.cc

index 6534e254ec2360802055200eaf8535ddbf2b9ecc..547e9056f0f62bac3665d33dd37afe2c6565c6a7 100644 (file)
@@ -268,6 +268,11 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs,
       bool exists;
       string val = s->info.args.get(p->param, &exists);
       if (exists) {
+       /* reject unauthenticated response header manipulation, see
+        * https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html */
+       if (s->auth.identity->is_anonymous()) {
+         return -EPERM;
+       }
        if (strcmp(p->param, "response-content-type") != 0) {
          response_attrs[p->http_attr] = val;
        } else {