From 6be81e300a5c4e839b68b8bd6579fcd6c235df97 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Fri, 21 Sep 2018 14:49:34 -0700 Subject: [PATCH] rgw: enforce bounds on max-keys/max-uploads/max-parts RGW S3 listing operations provided a way for authenticated users to cause a denial of service against OMAPs holding bucket indices. Bound the min & max values that a user could pass into the max-X parameters, to keep the system safe. The default of 1000 is chosen to match AWS S3 behavior. Affected operations: - ListBucket, via max-keys - ListBucketVersions, via max-keys - ListBucketMultiPartUploads, via max-uploads - ListMultipartUploadParts, via max-parts The Swift bucket listing codepath already enforced a limit, so is unaffected by this issue. Prior to this commit, the effective limit is the lower of osd_max_omap_entries_per_request or osd_max_omap_bytes_per_request. Backport: luminous, mimic Fixes: http://tracker.ceph.com/issues/35994 Signed-off-by: Robin H. Johnson (cherry picked from commit d79f68a1e31f4bc917eec1b6bbc8e8446377dc6b) Conflicts: src/common/options.cc: Conflicts due to options from master --- src/common/options.cc | 11 +++++++++++ src/rgw/rgw_op.cc | 21 +++++---------------- src/rgw/rgw_op.h | 25 +++++++++++++++++++++++++ src/rgw/rgw_rest.cc | 11 +++++------ src/rgw/rgw_rest_swift.cc | 2 ++ 5 files changed, 48 insertions(+), 22 deletions(-) diff --git a/src/common/options.cc b/src/common/options.cc index b2246579eb8c6..a543256d8ad33 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -6233,6 +6233,17 @@ std::vector