all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Fiona Ebner <f.ebner@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH storage] api: prune backups: dry run: filter volumes based on permissions
Date: Wed, 04 Nov 2026 11:05:40 +0100	[thread overview]
Message-ID: <1793786547.s184gmlsjf.astroid@yuna.none> (raw)
In-Reply-To: <20261103151432.197799-1-f.ebner@proxmox.com>

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.
> 
> 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 <f.ebner@proxmox.com>
> ---
>  src/PVE/API2/Storage/PruneBackups.pm | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> 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 => sub {
>          my ($param) = @_;
>  
> +        my $rpcenv = PVE::RPCEnvironment::get();
> +        my $authuser = $rpcenv->get_user();
> +
>          my $cfg = PVE::Storage::config();
>  
>          my $vmid = extract_param($param, 'vmid');
> @@ -110,7 +113,19 @@ __PACKAGE__->register_method({
>          $prune_backups = PVE::JSONSchema::parse_property_string('prune-backups', $prune_backups)
>              if defined($prune_backups);
>  
> -        return PVE::Storage::prune_backups($cfg, $storeid, $prune_backups, $vmid, $type, 1);
> +        my $result = [];
> +        my $prune_list =
> +            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->{volid}, 'backup',
> +                );
> +            };
> +            next if $@;
> +            push $result->@*, $prune_entry;
> +        }
> +        return $result;
>      },
>  });
>  
> -- 
> 2.47.3
> 
> 
> 
> 
> 
> 




  reply	other threads:[~2026-11-04 10:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 15:14 [PATCH storage] api: prune backups: dry run: filter volumes based on permissions Fiona Ebner
2026-11-04 10:05 ` Fabian Grünbichler [this message]
2026-11-05 10:39 ` superseded: " Fiona Ebner

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=1793786547.s184gmlsjf.astroid@yuna.none \
    --to=f.gruenbichler@proxmox.com \
    --cc=f.ebner@proxmox.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal