public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH access-control] schema: disallow '0' as a pool name
Date: Wed, 21 May 2025 14:15:10 +0200	[thread overview]
Message-ID: <20250521121510.113426-1-f.ebner@proxmox.com> (raw)

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.

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;
-- 
2.39.5



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


             reply	other threads:[~2025-05-21 12:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21 12:15 Fiona Ebner [this message]
2025-05-22  5:51 ` Thomas Lamprecht
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=20250521121510.113426-1-f.ebner@proxmox.com \
    --to=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