public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Christian Ludwig <christian_ludwig@genua.de>,
	pve-devel@lists.proxmox.com
Subject: Re: [PATCH v2 pve-storage 4/16] api: status: support efi-firmware in upload and download-url
Date: Mon, 5 Oct 2026 16:37:04 +0200	[thread overview]
Message-ID: <b3da858b-bb4f-4132-be27-ec7a9c90316b@proxmox.com> (raw)
In-Reply-To: <62b59850da5ca40be46662b94e10d5499e615c04.1790337423.git@genua.de>

Am 28.09.26 um 7:49 AM schrieb Christian Ludwig:
> Allow the content type in both endpoints and reject file names outside
> the safe character class.
> 
> Signed-off-by: Christian Ludwig <christian_ludwig@genua.de>
> ---
>  src/PVE/API2/Storage/Status.pm | 14 ++++++++++++--
>  src/PVE/Storage.pm             | 18 ++++++++++++++++--
>  2 files changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/src/PVE/API2/Storage/Status.pm b/src/PVE/API2/Storage/Status.pm
> index 741d514..a6fc317 100644
> --- a/src/PVE/API2/Storage/Status.pm
> +++ b/src/PVE/API2/Storage/Status.pm
> @@ -533,7 +533,7 @@ __PACKAGE__->register_method({
>                  description => "Content type.",
>                  type => 'string',
>                  format => 'pve-storage-content',
> -                enum => ['iso', 'vztmpl', 'import'],
> +                enum => ['iso', 'vztmpl', 'import', 'efi-firmware'],
>              },
>              filename => {
>                  description =>
> @@ -618,6 +618,11 @@ __PACKAGE__->register_method({
>              }
>  
>              $path = PVE::Storage::get_import_dir($cfg, $storage);
> +        } elsif ($content eq 'efi-firmware') {
> +            if ($filename !~ m!${PVE::Storage::SAFE_CHAR_CLASS_RE}+$!) {

Note: if we go for enforcing extensions as suggested in patch 1/16, this
needs to be adapted as well.

> +                raise_param_exc({ filename => "invalid file name" });
> +            }
> +            $path = PVE::Storage::get_efi_firmware_dir($cfg, $storage);
>          } else {
>              raise_param_exc({ content => "upload content type '$content' not allowed" });
>          }

I'd like to have the image be validated below, where validation for
other types already happens, with something like:
my ($undef, $format) =
    file_size_info($tmpfilename, 10, 'auto-detect', 1);
die "..." if $format ne 'raw';

> @@ -770,7 +775,7 @@ __PACKAGE__->register_method({
>                  description => "Content type.", # TODO: could be optional & detected in most cases
>                  type => 'string',
>                  format => 'pve-storage-content',
> -                enum => ['iso', 'vztmpl', 'import'],
> +                enum => ['iso', 'vztmpl', 'import', 'efi-firmware'],
>              },
>              filename => {
>                  description =>
> @@ -859,6 +864,11 @@ __PACKAGE__->register_method({
>              }
>  
>              $path = PVE::Storage::get_import_dir($cfg, $storage);
> +        } elsif ($content eq 'efi-firmware') {
> +            if ($filename !~ m!${PVE::Storage::SAFE_CHAR_CLASS_RE}+$!) {
> +                raise_param_exc({ filename => "invalid file name" });
> +            }
> +            $path = PVE::Storage::get_efi_firmware_dir($cfg, $storage);

Similar comments as above apply here too.

>          } else {
>              raise_param_exc({ content => "upload content-type '$content' is not allowed" });
>          }
> diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
> index 64ea9da..112a828 100755
> --- a/src/PVE/Storage.pm
> +++ b/src/PVE/Storage.pm
> @@ -555,6 +555,15 @@ sub get_iso_dir {
>      return $plugin->get_subdir($scfg, 'iso');
>  }
>  
> +sub get_efi_firmware_dir {
> +    my ($cfg, $storeid) = @_;
> +
> +    my $scfg = storage_config($cfg, $storeid);
> +    my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
> +
> +    return $plugin->get_subdir($scfg, 'efi-firmware');
> +}
> +
>  sub get_import_dir {
>      my ($cfg, $storeid) = @_;
>  
> @@ -629,7 +638,12 @@ sub check_volume_access {
>  
>          return if $rpcenv->check($user, "/storage/$sid", ['Datastore.Allocate'], 1);
>  
> -        if ($vtype eq 'iso' || $vtype eq 'vztmpl' || $vtype eq 'import') {
> +        if (
> +            $vtype eq 'iso'
> +            || $vtype eq 'vztmpl'
> +            || $vtype eq 'import'
> +            || $vtype eq 'efi-firmware'
> +        ) {

This hunk belongs to patch 1/16.

>              # require at least read access to storage, (custom) templates/ISOs could be sensitive
>              $rpcenv->check_any(
>                  $user,
> @@ -1297,7 +1311,7 @@ sub template_list {
>  sub volume_list {
>      my ($cfg, $storeid, $vmid, $content) = @_;
>  
> -    my @ctypes = qw(rootdir images vztmpl iso backup snippets import);
> +    my @ctypes = qw(rootdir images vztmpl iso backup snippets import efi-firmware);

This hunk belongs to patch 1/16.

>  
>      my $cts = $content ? [$content] : [@ctypes];
>  

Best Regards,
Fiona




  reply	other threads:[~2026-10-05 14:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28  5:47 [PATCH v2 0/16] Support for custom EFI firmware Christian Ludwig
2026-09-28  5:47 ` [PATCH v2 pve-storage 1/16] plugin: add efi-firmware content type Christian Ludwig
2026-10-05 14:37   ` Fiona Ebner
2026-09-28  5:47 ` [PATCH v2 pve-storage 2/16] test: get_subdir: cover the " Christian Ludwig
2026-10-05 14:36   ` Fiona Ebner
2026-09-28  5:48 ` [PATCH v2 pve-storage 3/16] plugins: allow the efi-firmware content type on file based storages Christian Ludwig
2026-10-05 14:36   ` Fiona Ebner
2026-09-28  5:48 ` [PATCH v2 pve-storage 4/16] api: status: support efi-firmware in upload and download-url Christian Ludwig
2026-10-05 14:37   ` Fiona Ebner [this message]
2026-09-28  5:48 ` [PATCH v2 pve-storage 5/16] test: volume access: cover efi-firmware volumes Christian Ludwig
2026-10-05 14:36   ` Fiona Ebner
2026-09-28  5:48 ` [PATCH v2 pve-storage 6/16] test: list volumes: " Christian Ludwig
2026-10-05 14:37   ` Fiona Ebner
2026-09-28  5:48 ` [PATCH v2 qemu-server 07/16] config: add the efi-firmware option Christian Ludwig
2026-10-05 14:37   ` Fiona Ebner
2026-09-28  5:48 ` [PATCH v2 qemu-server 08/16] api: allow setting " Christian Ludwig
2026-10-05 14:36   ` Fiona Ebner
2026-09-28  5:48 ` [PATCH v2 qemu-server 09/16] ovmf: use a custom firmware image if configured Christian Ludwig
2026-10-05 14:36   ` Fiona Ebner
2026-09-28  5:48 ` [PATCH v2 qemu-server 10/16] test: efi-firmware key in VM config Christian Ludwig
2026-09-28  5:48 ` [PATCH v2 qemu-server 11/16] test: efi-firmware volumes replication Christian Ludwig
2026-09-28  5:48 ` [PATCH v2 pve-manager 12/16] ui: storage: add efi-firmware content type support Christian Ludwig
2026-09-28  5:48 ` [PATCH v2 pve-manager 13/16] ui: form: support other content types in the ISO selector Christian Ludwig
2026-09-28  5:48 ` [PATCH v2 pve-manager 14/16] ui: qemu: allow selecting a custom EFI firmware image Christian Ludwig
2026-09-28  5:48 ` [PATCH v2 pve-docs 15/16] pvesm: document the efi-firmware content type Christian Ludwig
2026-09-28  5:48 ` [PATCH v2 pve-docs 16/16] qm: document the efi-firmware VM option Christian Ludwig
2026-10-05 14:36 ` [PATCH v2 0/16] Support for custom EFI firmware Fiona Ebner
2026-10-08  8:37   ` Christian Ludwig

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=b3da858b-bb4f-4132-be27-ec7a9c90316b@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=christian_ludwig@genua.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