From: Elias Huhsovitz <e.huhsovitz@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Elias Huhsovitz <e.huhsovitz@proxmox.com>
Subject: [PATCH manager] fix #6735: api: pci: extend mdevscan persmissions for mappings
Date: Mon, 24 Aug 2026 13:26:10 +0200 [thread overview]
Message-ID: <20260824112610.148089-1-e.huhsovitz@proxmox.com> (raw)
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 <e.huhsovitz@proxmox.com>
---
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,
--
2.47.3
reply other threads:[~2026-08-24 11:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260824112610.148089-1-e.huhsovitz@proxmox.com \
--to=e.huhsovitz@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.