]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/oidc: Allow thumbprints to be optional for oidc operations. 67656/head
authorKrunal Chheda <kchheda3@bloomberg.net>
Wed, 4 Mar 2026 17:05:36 +0000 (12:05 -0500)
committerKrunal Chheda <kchheda3@bloomberg.net>
Thu, 12 Mar 2026 18:40:48 +0000 (14:40 -0400)
Signed-off-by: Krunal Chheda <kchheda3@bloomberg.net>
src/rgw/rgw_rest_oidc_provider.cc
src/rgw/rgw_rest_sts.cc

index f4b49de9627619c9d44b3da21b6fab5036144505..fd3ca9ff3be6bbac8b802284e244a426c3f18fa8 100644 (file)
@@ -104,10 +104,6 @@ int RGWCreateOIDCProvider::init_processing(optional_yield y)
     }
   }
 
-  if (info.thumbprints.empty()) {
-    s->err.message = "Missing required element ThumbprintList";
-    return -EINVAL;
-  }
   if (info.thumbprints.size() > MAX_OIDC_NUM_THUMBPRINTS) {
     s->err.message = "ThumbprintList cannot exceed the maximum size of "
         + std::to_string(MAX_OIDC_NUM_THUMBPRINTS);
index e2d16d56988b0b7ef022a76171e48c00ee84e5de..f5f9041d47be56de4988a0c38a9ba70fb63eb379 100644 (file)
@@ -586,6 +586,12 @@ bool WebTokenEngine::verify_oidc_thumbprint(const DoutPrefixProvider* dpp, const
     return true;
   }
 
+  if (thumbprints.empty()) {
+    ldpp_dout(dpp, 5) << "No thumbprints registered with oidc provider,"
+                         " skipping JWKS url verification" << dendl;
+    return true;
+  }
+
   // Fetch and verify cert according to https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc_verify-thumbprint.html
   const auto hostname = get_top_level_domain_from_host(dpp, cert_url);
   ldpp_dout(dpp, 20) << "Validating hostname: " << hostname << dendl;
@@ -652,7 +658,14 @@ WebTokenEngine::validate_signature(const DoutPrefixProvider* dpp, const jwt::dec
             if (JSONDecoder::decode_json("x5c", x5c, &k_parser)) {
               string cert;
               bool found_valid_cert = false;
-              bool skip_thumbprint_verification = cct->_conf.get_val<bool>("rgw_enable_jwks_url_verification");
+              bool skip_thumbprint_verification = cct->_conf.get_val<bool>(
+                  "rgw_enable_jwks_url_verification");
+              if (!skip_thumbprint_verification && thumbprints.empty()) {
+                ldpp_dout(dpp, 0) << "x5c cert validation requires registered "
+                                     "thumbprints, but thumbprint list is empty"
+                                  << dendl;
+                throw std::system_error(EINVAL, std::system_category());
+              }
               for (auto& it : x5c) {
                 cert = "-----BEGIN CERTIFICATE-----\n" + it + "\n-----END CERTIFICATE-----";
                 ldpp_dout(dpp, 20) << "Certificate is: " << cert.c_str() << dendl;