public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Fiona Ebner <f.ebner@proxmox.com>
Subject: Re: [pve-devel] [PATCH access-control] schema: disallow '0' as a pool name
Date: Thu, 22 May 2025 07:51:44 +0200	[thread overview]
Message-ID: <8518b311-e11a-4721-8bb3-f63faec4dd5c@proxmox.com> (raw)
In-Reply-To: <20250521121510.113426-1-f.ebner@proxmox.com>

Am 21.05.25 um 14:15 schrieb Fiona Ebner:
> A pool with ID '0' can be added, but not parsed, because it will
> evaluate to false in parse_user_config():
> 
>> if (!verify_poolname($pool, 1)) {
>>     warn "user config - ignore pool '$pool' - invalid characters in pool name\n";
>>     next;
>> }
> 
> It's likely that it would cause other issues as well if properly
> handled there, so prohibit it in the schema.

Would be all bugs then though, and odd if I can use "1" or "2" but not "0".

IMO we better fix this for real or disallow all digits for the first character
on pool creation.

> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  src/PVE/AccessControl.pm | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/PVE/AccessControl.pm b/src/PVE/AccessControl.pm
> index 1c79656..224aeee 100644
> --- a/src/PVE/AccessControl.pm
> +++ b/src/PVE/AccessControl.pm
> @@ -1327,6 +1327,11 @@ sub verify_poolname {
>  	return undef;
>      }
>  
> +    if ($poolname eq '0') {
> +	die "invalid pool name '$poolname'\n" if !$noerr;
> +	return undef;
> +    }
> +
>      # also adapt check_path above if changed!
>      if ($poolname !~ m!^[A-Za-z0-9\.\-_]+(?:/[A-Za-z0-9\.\-_]+){0,2}$!) {
>  	die "pool name '$poolname' contains invalid characters\n" if !$noerr;



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2025-05-22  5:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21 12:15 Fiona Ebner
2025-05-22  5:51 ` Thomas Lamprecht [this message]
2025-05-22  6:19   ` Thomas Lamprecht
2025-05-26 14:23 ` [pve-devel] superseded: " Fiona Ebner

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=8518b311-e11a-4721-8bb3-f63faec4dd5c@proxmox.com \
    --to=t.lamprecht@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 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