public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH access-control] acl: pool: remove ACLs of nested pools on deletion
@ 2026-11-12 15:02 Jakob-Tobias Winter
  0 siblings, 0 replies; only message in thread
From: Jakob-Tobias Winter @ 2026-11-12 15:02 UTC (permalink / raw)
  To: pve-devel; +Cc: Jakob-Tobias Winter

Deleting a pool also removes the ACLs on its path. For a nested pool
like 'dev/team' this did nothing, as the ACL tree has a node per path
segment, not one for the whole pool name. The ACLs stayed in the user
config, so a pool created later with the same name granted the old
access again.

Look up the node of the pool along its path instead, keeping the ACLs
of its parent pools. ACLs left behind by earlier deletions stay until
a pool of that name, or one of its parent pools, is deleted.

Fixes: e7224f6 ("fix #1148: allow up to three levels of pool nesting")
Signed-off-by: Jakob-Tobias Winter <tobias@stuttgart.de>
---
 src/PVE/AccessControl.pm | 3 ++-
 src/test/perm-test6.pl   | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/PVE/AccessControl.pm b/src/PVE/AccessControl.pm
index a4e1c36..b211c5d 100644
--- a/src/PVE/AccessControl.pm
+++ b/src/PVE/AccessControl.pm
@@ -1090,7 +1090,8 @@ sub delete_group_acl {
 sub delete_pool_acl {
     my ($pool, $usercfg) = @_;
 
-    delete($usercfg->{acl_root}->{children}->{pool}->{children}->{$pool});
+    my ($parent, $last_key) = find_acl_tree_node_parent($usercfg->{acl_root}, "pool/$pool");
+    delete($parent->{children}->{$last_key}) if defined($last_key);
 }
 
 # we automatically create some predefined roles by splitting privs
diff --git a/src/test/perm-test6.pl b/src/test/perm-test6.pl
index 161833f..f0960d6 100755
--- a/src/test/perm-test6.pl
+++ b/src/test/perm-test6.pl
@@ -107,6 +107,11 @@ check_permissions('User2@pve', '/storage/store2', 'VM.PowerMgmt');
 check_permissions('User3@pve', '/storage/store2', 'VM.PowerMgmt');
 check_permissions('User4@pve', '/storage/store2', '');
 
+# removing the ACLs of a nested pool keeps those of its parent pool
+PVE::AccessControl::delete_pool_acl('marketing/interns', $rpcenv->{user_cfg});
+check_roles('intern@pve', '/pool/marketing/interns', '');
+check_roles('User4@pve', '/pool/marketing/interns', 'RoleMARKETING');
+
 print "all tests passed\n";
 
 exit(0);
-- 
2.53.0




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-12 15:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 15:02 [PATCH access-control] acl: pool: remove ACLs of nested pools on deletion Jakob-Tobias Winter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal