From: Tobias Urdin Date: Thu, 27 Jul 2023 14:59:45 +0000 (+0000) Subject: rgw/auth: check auth for http options requests X-Git-Tag: v16.2.15~190^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2d78f81aae15efc8fd096e6edf8bf5bc679004fa;p=ceph.git rgw/auth: check auth for http options requests If we get a HTTP OPTIONS request we previously always allowed the anonymous engine to handle the request even if other auth was given in the request. Fixes: https://tracker.ceph.com/issues/62033 Signed-off-by: Tobias Urdin (cherry picked from commit 135b6fc20e8ad094ed94e05bfb1975578abbbdab) --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index fdf9f28a21dd..3069e9b5c38b 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -5971,14 +5971,16 @@ rgw::auth::s3::STSEngine::authenticate( bool rgw::auth::s3::S3AnonymousEngine::is_applicable( const req_state* s ) const noexcept { - if (s->op == OP_OPTIONS) { - return true; - } - AwsVersion version; AwsRoute route; std::tie(version, route) = discover_aws_flavour(s->info); + /* If HTTP OPTIONS and no authentication provided using the + * anonymous engine is applicable */ + if (s->op == OP_OPTIONS && version == AwsVersion::UNKNOWN) { + return true; + } + return route == AwsRoute::QUERY_STRING && version == AwsVersion::UNKNOWN; }