all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Elias Huhsovitz" <e.huhsovitz@proxmox.com>
To: "Fiona Ebner" <f.ebner@proxmox.com>, <d.csapak@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [PATCH access-control] rpc: do not check malformed acl path
Date: Wed, 26 Aug 2026 14:53:35 +0200	[thread overview]
Message-ID: <DKYW2BYYARKN.TGY2TKE46ONR@proxmox.com> (raw)
In-Reply-To: <dfbb1552-ba7b-42c9-8ae2-f2f720aa70a5@proxmox.com>

Thanks for the quick response!

This was intended as a repsonse to this review:
https://lore.proxmox.com/pve-devel/8eff67e8-ac88-4b7d-a90d-de32644d1d95@proxmox.com/

I didn't mean for this to be a fully finished patch. This was meant
as a follow up.

I am unsure how to reply to a review while sharing code at
the same time. I relied on `--in-reply-to=` paramter too much.

Sorry for the trouble!

But your input resolves my confusion, so thanks a lot! :)


On Wed Aug 26, 2026 at 2:37 PM CEST, Fiona Ebner wrote:
> Missing rationale for why this is needed and why this is okay in the
> commit message. Always good to have, but especially for changes to
> permission checks.

[...]

>> Proposed solution
>> -----------------
>> IMHO providing explicit permissions on a raw PCI ID like 0000:01:00.0
>> instead of a mapping should not happen (i think) and should not be
>> checked. 
>> 
>> What is your opinion on simply not checking invalid ACL 
>> paths?
>> 
>> This would cause a more graceful failure. 
>
> Currently, the permission check for an invalid ACL path will still work
> for root@pam. With your patch, it won't work anymore. See the beginning
> of the permissions() sub.
>
> Note also the history here:
>
>> commit 37d3c16b25644f953647b512d9d231c866fa94e0
>> Author: Fabian Grünbichler <f.gruenbichler@proxmox.com>
>> Date:   Mon Jun 20 13:05:12 2022 +0200
>> 
>>     perm check: forbid undefined/empty ACL path
>>     
>>     to detect similar issues to that fixed in the previous commit early on
>>     and without the potential for dangerous side-effects.
>>     
>>     root@pam is intentionally still allowed before the check in case such
>>     situations can be triggered by misconfiguration - root@pam can then
>>     still clean up the affected configs via the GUI/API, and not just via
>>     manual editing.
>>     
>>     Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
>
> So this is done intentionally.
>
> What you can do is add a code comment, so people don't have to wonder
> about it again in the future, as well as adapt the exception message in
> case the path is undefined to avoid the ugly Perl warning.
>
> I still finished my review below for completeness ;)
>

[...]

>> 
>> diff --git a/src/PVE/RPCEnvironment.pm b/src/PVE/RPCEnvironment.pm
>> index 7591aa9..61ef28b 100644
>> --- a/src/PVE/RPCEnvironment.pm
>> +++ b/src/PVE/RPCEnvironment.pm
>> @@ -487,7 +487,11 @@ sub exec_api2_perm_check {
>>          }
>>          my $path = PVE::Tools::template_replace($tmplpath, $param);
>>          my $normpath = PVE::AccessControl::normalize_path($path);
>> -        warn "Failed to normalize '$path'\n" if !defined($normpath) && defined($path);
>> +
>> +        if (!defined($normpath)) {
>> +            warn "Failed to normalize ACL path '$path'\n" if defined($path);
>> +            return 0;
>
> This should rather be:
> return 0 if $noerr;
> raise_perm_exc();
>
> And I think we may assume that $path is defined and drop that post-if.
> Because we have
>
> die "missing parameters" if !($tmplpath && $privs);
>
> so $tmplpath is set and then we call
> my $path = PVE::Tools::template_replace($tmplpath, $param);
> which should always produce a defined result if $tmplpath is set.
>
> Even if that changes in the future for some reason, I'd rather get a
> warning with an undefined value than no warning here, so the issue will
> get noticed.
>
>> +        }
>>  
>>          return $self->check_full($username, $normpath, $privs, $any, $noerr);
>>      } elsif ($test eq 'userid-group') {





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

Thread overview: 7+ 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
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 [this message]
2026-08-26 13:03         ` Fiona Ebner
2026-08-26 13:04     ` Dominik Csapak

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=DKYW2BYYARKN.TGY2TKE46ONR@proxmox.com \
    --to=e.huhsovitz@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=f.ebner@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal