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 CCCD01FF0E1 for ; Wed, 26 Aug 2026 09:12:47 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 321B221302; Wed, 26 Aug 2026 09:12:47 +0200 (CEST) Message-ID: <8eff67e8-ac88-4b7d-a90d-de32644d1d95@proxmox.com> Date: Wed, 26 Aug 2026 09:12:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH manager] fix #6735: api: pci: extend mdevscan persmissions for mappings To: Elias Huhsovitz , pve-devel@lists.proxmox.com References: <20260824112610.148089-1-e.huhsovitz@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20260824112610.148089-1-e.huhsovitz@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1787728330242 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.451 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) KAM_MAILER 2 Automated Mailer Tag Left in Email POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes 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: 7M5FEWGQHBU254PRQN2ZJL2SMMEYO4WS X-Message-ID-Hash: 7M5FEWGQHBU254PRQN2ZJL2SMMEYO4WS X-MailFrom: d.csapak@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: hi, while testing this, i saw the following errors in the syslog: pveproxy[888583]: Failed to normalize '/mapping/pci/0000:08:00.0' pveproxy[888583]: internal error: ACL check called for undefined ACL path! i guess that something trips up the acl path normalize code (the '.' or the ':' probably?) also checking the id for the mapping path is not really correct. so i think the easiest way here would be to allow the api call for all users, and explicitely check the permissions in the api handler itself, after deciding if it's a mapping or a pci id. you can use 'raise_perm_exc' then to give the user the correct error message too. (we do this often when the permissions depend on the actual parameter) On 8/24/26 1:25 PM, Elias Huhsovitz wrote: > The mdevscan endpoint currently requires Sys.Audit or Sys.Modify on the > root path (/). This prevents non-admin users from querying available > mediated device types for a PCI mapping, even if they have explicit > Mapping.Use permissions on that specific mapping. > > Update the permission check to allow access if the user holds > Mapping.Use, Mapping.Modify, or Mapping.Audit on the respective mapping > path (i.e., /mapping/pci/{mapping}). This aligns the `GET > /nodes/{node}/hardware/pci/{pci-id-or-mapping}/mdev` endpoint with the > `GET /cluster/mapping/pci/{id}` endpoint. > > Signed-off-by: Elias Huhsovitz > --- > PVE/API2/Hardware/PCI.pm | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/PVE/API2/Hardware/PCI.pm b/PVE/API2/Hardware/PCI.pm > index 36b9741b..de62bcd8 100644 > --- a/PVE/API2/Hardware/PCI.pm > +++ b/PVE/API2/Hardware/PCI.pm > @@ -180,7 +180,18 @@ __PACKAGE__->register_method({ > protected => 1, > proxyto => "node", > permissions => { > - check => ['perm', '/', ['Sys.Audit', 'Sys.Modify'], any => 1], > + description => "Requires 'Sys.Audit' or 'Sys.Modify' on '/' for PCI IDs," > + . " or mapping permissions on the respective mapping.", > + check => [ > + 'or', > + ['perm', '/', ['Sys.Audit', 'Sys.Modify'], any => 1], > + [ > + 'perm', > + '/mapping/pci/{pci-id-or-mapping}', > + ['Mapping.Use', 'Mapping.Modify', 'Mapping.Audit'], > + any => 1, > + ], > + ], > }, > parameters => { > additionalProperties => 0,