From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id DE2B61FF0C0 for ; Wed, 04 Nov 2026 11:05:49 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 7039E211F1; Wed, 04 Nov 2026 11:05:47 +0100 (CET) Date: Wed, 04 Nov 2026 11:05:40 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= Subject: Re: [PATCH storage] api: prune backups: dry run: filter volumes based on permissions To: Fiona Ebner , pve-devel@lists.proxmox.com References: <20261103151432.197799-1-f.ebner@proxmox.com> In-Reply-To: <20261103151432.197799-1-f.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.17.0 (https://github.com/astroidmail/astroid) Message-Id: <1793786547.s184gmlsjf.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793786743174 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.675 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: ADN4K4I3FZGNKMKA22UAQNDKPU4NEZIZ X-Message-ID-Hash: ADN4K4I3FZGNKMKA22UAQNDKPU4NEZIZ X-MailFrom: f.gruenbichler@proxmox.com 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 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On November 3, 2026 4:14 pm, Fiona Ebner wrote: > In the API endpoint for the prune backups dry run, filter volumes in > the result based on permissions using check_volume_access(), similar > to what the API endpoint for listing storage contents is already > doing. >=20 > The permission check is based on permissions for the storage and the > 'VM.Backup' permission for guest IDs, so each backup group is either > fully absent or fully present in the result. this now makes the Audit privilege check on the endpoint itself meaningless? I think we should either switch this endpoint to do the same check as the actual pruning does (modulo Audit|AllocateSpace vs just AllocateSpace), or switch both over to check_volume_access and drop the Audit part.. > Signed-off-by: Fiona Ebner > --- > src/PVE/API2/Storage/PruneBackups.pm | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) >=20 > diff --git a/src/PVE/API2/Storage/PruneBackups.pm b/src/PVE/API2/Storage/= PruneBackups.pm > index 2920c89..60a8182 100644 > --- a/src/PVE/API2/Storage/PruneBackups.pm > +++ b/src/PVE/API2/Storage/PruneBackups.pm > @@ -100,6 +100,9 @@ __PACKAGE__->register_method({ > code =3D> sub { > my ($param) =3D @_; > =20 > + my $rpcenv =3D PVE::RPCEnvironment::get(); > + my $authuser =3D $rpcenv->get_user(); > + > my $cfg =3D PVE::Storage::config(); > =20 > my $vmid =3D extract_param($param, 'vmid'); > @@ -110,7 +113,19 @@ __PACKAGE__->register_method({ > $prune_backups =3D PVE::JSONSchema::parse_property_string('prune= -backups', $prune_backups) > if defined($prune_backups); > =20 > - return PVE::Storage::prune_backups($cfg, $storeid, $prune_backup= s, $vmid, $type, 1); > + my $result =3D []; > + my $prune_list =3D > + PVE::Storage::prune_backups($cfg, $storeid, $prune_backups, = $vmid, $type, 1); > + for my $prune_entry ($prune_list->@*) { > + eval { > + PVE::Storage::check_volume_access( > + $rpcenv, $authuser, $cfg, undef, $prune_entry->{voli= d}, 'backup', > + ); > + }; > + next if $@; > + push $result->@*, $prune_entry; > + } > + return $result; > }, > }); > =20 > --=20 > 2.47.3 >=20 >=20 >=20 >=20 >=20 >=20