]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: reject unauthenticated response-header actions
authorMatt Benjamin <mbenjamin@redhat.com>
Fri, 27 Mar 2020 17:13:48 +0000 (18:13 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Wed, 8 Apr 2020 15:34:55 +0000 (17:34 +0200)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Reviewed-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)

src/rgw/rgw_rest_s3.cc

index b0e36dec5d8e51772c076b3a4204cde11064a884..5dc6a5620513be68dbd631a47cda38abbd37d5af 100644 (file)
@@ -266,6 +266,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 {