From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 384821FF0B6 for ; Thu, 12 Nov 2026 16:02:43 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id C0CA021679; Thu, 12 Nov 2026 16:02:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stuttgart.de; s=s1022; t=1794495744; bh=YowixDYkI68lmK5ul5xoqFhaSSvtiHbG+v5TNGKJdV8=; h=From:To:Cc:Subject:Date:From; b=dwvmat9pASlhXi10XmMLh+mJ65qPJoBS5MpcsRslhoUf028H42ftxVmeU8QQH7NSQ woMMPvQSi5EWR2El1B0FzhkoArWvct7IQ86LDvD9yRR8kVovfJM4DNz1PQKCG4jjXQ 5F+NMSdLR9IKpjmphS62CDX+/mn18HZr8xgnYW4q1oDYIc1EKbx5o2e/fw0e4h7WY0 T6bDVrazhupN79fylJWeQ+p+aXXd+iO/4rY7Ne0sDeU0LuJz0W87Tl1DvL5T7K6+Cc G+GLNTljOqzTZqX9COxwfOqqQ4p5BAs28983fzoyVTsUMQtHiYMGjUTHrPO41KXTg9 iuxVal0Rv6+xQ== From: Jakob-Tobias Winter To: pve-devel@lists.proxmox.com Subject: [PATCH access-control] acl: pool: remove ACLs of nested pools on deletion Date: Thu, 12 Nov 2026 16:02:12 +0100 Message-ID: <20261112150211.846966-2-tobias@stuttgart.de> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_PASS -0.001 SPF: HELO matches SPF record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 75EYAKVCXO35GY4GUEHE745FGGIQNTVM X-Message-ID-Hash: 75EYAKVCXO35GY4GUEHE745FGGIQNTVM X-MailFrom: prvs=f560d3371a=tobias@stuttgart.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Jakob-Tobias Winter X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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