public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Jakob-Tobias Winter <tobias@stuttgart.de>
To: pve-devel@lists.proxmox.com
Cc: Jakob-Tobias Winter <tobias@stuttgart.de>
Subject: [PATCH access-control] acl: pool: remove ACLs of nested pools on deletion
Date: Thu, 12 Nov 2026 16:02:12 +0100	[thread overview]
Message-ID: <20261112150211.846966-2-tobias@stuttgart.de> (raw)

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




                 reply	other threads:[~2026-11-12 15:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112150211.846966-2-tobias@stuttgart.de \
    --to=tobias@stuttgart.de \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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