]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/auth: check auth for http options requests
authorTobias Urdin <tobias.urdin@binero.se>
Thu, 27 Jul 2023 14:59:45 +0000 (14:59 +0000)
committerMykola Golub <mgolub@suse.com>
Tue, 12 Sep 2023 09:12:33 +0000 (12:12 +0300)
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 <tobias.urdin@binero.com>
(cherry picked from commit 135b6fc20e8ad094ed94e05bfb1975578abbbdab)

src/rgw/rgw_rest_s3.cc

index 497afc19d5d96d6ef1441b27b15eeba3bb317c59..efd23a3e17ee34c8303435e63d61ab047d3c4d67 100644 (file)
@@ -6456,14 +6456,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;
 }