* [pve-devel] [PATCH v3 manager] api: create pool: force first character to be a letter for new pools
@ 2025-07-24 8:31 Fiona Ebner
2025-07-29 6:29 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2025-07-24 8:31 UTC (permalink / raw)
To: pve-devel
Currently, the first character can also be a digit, '.', '-', or '_'.
Almost all other configuration IDs in Proxmox VE require starting with
a letter, so force this for new pool names too.
A pool with ID '0' can be added, but not parsed, because it will
evaluate to false in PVE/AccessControl.pm's 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.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Changes in v3:
* rebase on master, make tidy
PVE/API2/Pool.pm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/PVE/API2/Pool.pm b/PVE/API2/Pool.pm
index 138b50a6..63aff5bb 100644
--- a/PVE/API2/Pool.pm
+++ b/PVE/API2/Pool.pm
@@ -189,10 +189,13 @@ __PACKAGE__->register_method({
my $pool = $param->{poolid};
die "pool '$pool' already exists\n" if $usercfg->{pools}->{$pool};
- if ($pool =~ m!^(.*)/[^/]+$!) {
- my $parent = $1;
+ if ($pool =~ m!^(.*)/([^/]+)$!) {
+ my ($parent, $leaf) = ($1, $2);
die "parent '$parent' of pool '$pool' does not exist\n"
if !defined($usercfg->{pools}->{$parent});
+ die "pool name must start with a letter\n" if $leaf !~ m!^[A-Za-z]!;
+ } else {
+ die "pool name must start with a letter\n" if $pool !~ m!^[A-Za-z]!;
}
$usercfg->{pools}->{$pool} = {
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH v3 manager] api: create pool: force first character to be a letter for new pools
2025-07-24 8:31 [pve-devel] [PATCH v3 manager] api: create pool: force first character to be a letter for new pools Fiona Ebner
@ 2025-07-29 6:29 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-07-29 6:29 UTC (permalink / raw)
To: pve-devel, Fiona Ebner
On Thu, 24 Jul 2025 10:31:58 +0200, Fiona Ebner wrote:
> Currently, the first character can also be a digit, '.', '-', or '_'.
> Almost all other configuration IDs in Proxmox VE require starting with
> a letter, so force this for new pool names too.
>
> A pool with ID '0' can be added, but not parsed, because it will
> evaluate to false in PVE/AccessControl.pm's parse_user_config():
>
> [...]
Applied, thanks!
[1/1] api: create pool: force first character to be a letter for new pools
commit: 7eadbed6b0995e1ccc7b06fce091fd054dc58792
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-29 6:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-24 8:31 [pve-devel] [PATCH v3 manager] api: create pool: force first character to be a letter for new pools Fiona Ebner
2025-07-29 6:29 ` [pve-devel] applied: " Thomas Lamprecht
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.