]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: reject user tenant that looks like an account id
authorCasey Bodley <cbodley@redhat.com>
Tue, 12 Mar 2024 22:53:05 +0000 (18:53 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 10 Apr 2024 17:09:17 +0000 (13:09 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/rados/rgw_user.cc

index 43951559520a40f70b032cc4bbe983816c0e83c2..e154813aac1c7f06fa622b74a2e5dc9aa681d7fe 100644 (file)
@@ -1753,6 +1753,12 @@ int RGWUser::execute_add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_
   user_info.display_name = display_name;
   user_info.type = TYPE_RGW;
 
+  // tenant must not look like a valid account id
+  if (rgw::account::validate_id(uid.tenant)) {
+    set_err_msg(err_msg, "tenant must not be formatted as an account id");
+    return -EINVAL;
+  }
+
   if (!user_email.empty())
     user_info.user_email = user_email;