]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: stop crashing when an admin tries to assume a nonexistent role 69001/head
authorMatthew N. Heler <matthew.heler@hotmail.com>
Tue, 17 Mar 2026 20:33:32 +0000 (15:33 -0500)
committerMatthew N. Heler <matthew.heler@hotmail.com>
Tue, 19 May 2026 16:49:12 +0000 (11:49 -0500)
An admin user sending an AssumeRole request for a role that doesn't
exist would crash rgw. The permission check failed but got
overridden because the caller was an admin, and the code that ran
next blindly assumed the role had already been loaded. Fixed by
loading the role directly instead of hoping it was done earlier.

Signed-off-by: Matthew N. Heler <matthew.heler@hotmail.com>
(cherry picked from commit a1f1811f50509f6986198b95d51802c328afa9af)

src/rgw/rgw_sts.cc

index 951af012b482f7184b648f6592320264f7fb489d..d57d784464bfab33c8e7ce11f352df675fde814c 100644 (file)
@@ -399,16 +399,16 @@ AssumeRoleResponse STSService::assumeRole(const DoutPrefixProvider *dpp,
   AssumeRoleResponse response;
   response.packedPolicySize = 0;
 
-  //Get the role info which is being assumed
-  boost::optional<rgw::ARN> r_arn = rgw::ARN::parse(req.getRoleARN());
-  if (r_arn == boost::none) {
-    ldpp_dout(dpp, 0) << "Error in parsing role arn: " << req.getRoleARN() << dendl;
-    response.retCode = -EINVAL;
+  auto [ret, r] = getRoleInfo(dpp, req.getRoleARN(), y);
+  if (ret < 0) {
+    response.retCode = ret;
     return response;
   }
 
-  string roleId = role->get_id();
-  uint64_t roleMaxSessionDuration = role->get_max_session_duration();
+  boost::optional<rgw::ARN> r_arn = rgw::ARN::parse(req.getRoleARN());
+
+  string roleId = r->get_id();
+  uint64_t roleMaxSessionDuration = r->get_max_session_duration();
   req.setMaxDuration(roleMaxSessionDuration);
 
   //Validate input