]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw-admin: 'user create' rejects uids matching the account id format 60830/head
authorCasey Bodley <cbodley@redhat.com>
Mon, 25 Nov 2024 18:07:46 +0000 (13:07 -0500)
committerCasey Bodley <cbodley@redhat.com>
Mon, 25 Nov 2024 18:07:50 +0000 (13:07 -0500)
`parse_owner()` relies on `rgw::account::validate_id()` to disambiguate
between user ids and account ids. reject attempts to create a user with
an ambiguous user id

Fixes: https://tracker.ceph.com/issues/69043
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/rados/rgw_user.cc

index 94a18ffcbab75a51da77c55305c5133ad88b8704..894d8e4095091cf665a75f7849e9a25c51f91165 100644 (file)
@@ -1755,7 +1755,11 @@ 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
+  // user/tenant must not look like a valid account id
+  if (rgw::account::validate_id(uid.id)) {
+    set_err_msg(err_msg, "uid must not be formatted as an account id");
+    return -EINVAL;
+  }
   if (rgw::account::validate_id(uid.tenant)) {
     set_err_msg(err_msg, "tenant must not be formatted as an account id");
     return -EINVAL;