public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Elias Huhsovitz <e.huhsovitz@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH manager] fix #6735: api: pci: extend mdevscan persmissions for mappings
Date: Wed, 26 Aug 2026 09:12:41 +0200	[thread overview]
Message-ID: <8eff67e8-ac88-4b7d-a90d-de32644d1d95@proxmox.com> (raw)
In-Reply-To: <20260824112610.148089-1-e.huhsovitz@proxmox.com>

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 <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,





  reply	other threads:[~2026-08-26  7:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 11:26 [PATCH manager] fix #6735: api: pci: extend mdevscan persmissions for mappings Elias Huhsovitz
2026-08-26  7:12 ` Dominik Csapak [this message]
2026-08-26 10:37   ` [PATCH access-control] rpc: do not check malformed acl path Elias Huhsovitz
2026-08-26 12:37     ` Fiona Ebner
2026-08-26 12:53       ` Elias Huhsovitz
2026-08-26 13:03         ` Fiona Ebner
2026-08-26 13:04     ` Dominik Csapak
2026-08-27 11:28 ` superseded: [PATCH manager] fix #6735: api: pci: extend mdevscan persmissions for mappings Elias Huhsovitz

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=8eff67e8-ac88-4b7d-a90d-de32644d1d95@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=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 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