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 530B61FF0A7 for ; Mon, 17 Aug 2026 14:00:09 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3BBC423DB7; Mon, 17 Aug 2026 13:59:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=genua.de; s=202307; t=1786967966; bh=b+t3jIj1PqI5PmFN+lZD+ZV0xGLplPgxS69XB4/RMqU=; h=Date:From:To:Subject:References:In-Reply-To:From; b=xQ2QybgMKgcI74PlUBfr/AUBJ3j19RJ6Fwp7hp+UuI2UctRkH3lP6ZS5rjQ3nvPGn E/dZfa0tqop5KjRbLsuE/Rsdsto1p1T8amJsUa4p1p8MbABIJ1/cgjP9cI14H/UB+N SJggCK+wNBSkrd/iMX+6N8LfiS9jvqrUGBs6nkxqVzhnDkcEbzyhc6v71lQGX3IocQ pZ9qdal9x0Pc/+lNyL6tmYU5fSgJNHP3jic6MEnY0B5CxxDYMeae+qw5fB9nc9mx8e ZRecZaH1MY9ZG7AV5/8zV2imjsnd68RU6QCW8dMZYv80ggAWDhL7bNH95jYH5JzcFD GGUEKNjTXE4wg== Date: Mon, 17 Aug 2026 13:59:25 +0200 From: Christian Ludwig To: Subject: [PATCH pve-storage 4/13] Extend storage API endpoints for efi-firmware Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [192.168.217.185] X-ClientProxiedBy: kch1-mta07.win.genua.de (10.208.16.107) To kch1-mta07.win.genua.de (10.208.16.107) Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg="sha-256"; boundary="----C6606E9C6D9FC700FD3B4013B59B8436" X-SPAM-LEVEL: Spam detection results: 0 AWL 0.182 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 SPF_HELO_PASS -0.001 SPF: HELO matches SPF record SPF_PASS -0.001 SPF: sender matches SPF record UNPARSEABLE_RELAY 0.001 Informational: message has unparseable relay lines Message-ID-Hash: PPKMNLN3KYT43UIOAFCANEK4K3TDWFED X-Message-ID-Hash: PPKMNLN3KYT43UIOAFCANEK4K3TDWFED X-MailFrom: christian_ludwig@genua.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 X-Content-Filtered-By: Mailman/MimeDel 3.3.10 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ------C6606E9C6D9FC700FD3B4013B59B8436 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Extend the storage upload and download-url API endpoints for the efi-firmware content type. Provide an error message if the file name does not match the safe character set. Signed-off-by: Christian Ludwig --- src/PVE/API2/Storage/Status.pm | 14 ++++++++++++-- src/PVE/Storage.pm | 13 +++++++++++-- 2 files changed, 23 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}+$!) { + 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" }); } @@ -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); } 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..1083b1d 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,7 @@ 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') { # require at least read access to storage, (custom) templates/ISOs could be sensitive $rpcenv->check_any( $user, @@ -1297,7 +1306,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); my $cts = $content ? [$content] : [@ctypes]; -- 2.34.1 ------C6606E9C6D9FC700FD3B4013B59B8436--