]> git.apps.os.sepia.ceph.com Git - ceph-ci.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>
Fri, 12 Apr 2024 19:34:29 +0000 (15:34 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 4180724b5a38d560cddfb6cf04b0baa23915e4a6)

src/rgw/driver/rados/rgw_user.cc

index d764bd6c181e963b6b0b5f4ab0ae42d93f60a42f..5fe57c6514721972a6321131193587e5ef8b1d8c 100644 (file)
@@ -1749,6 +1749,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;