From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 614111FF15E for ; Wed, 21 Jan 2026 11:34:43 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 005DF22118; Wed, 21 Jan 2026 11:34:55 +0100 (CET) From: Arthur Bied-Charreton To: pve-devel@lists.proxmox.com Date: Wed, 21 Jan 2026 11:32:32 +0100 Message-ID: <20260121103407.187187-5-a.bied-charreton@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121103407.187187-1-a.bied-charreton@proxmox.com> References: <20260121103407.187187-1-a.bied-charreton@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.076 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pve-devel] [PATCH pve-network 1/2] fix #7077: Improve error messages for ID length mismatch X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Add explicit length checks to ID validation functions to provide clearer error messages in case of length mismatches Signed-off-by: Arthur Bied-Charreton --- src/PVE/Network/SDN/Controllers/Plugin.pm | 5 +++++ src/PVE/Network/SDN/Dns/Plugin.pm | 5 +++++ src/PVE/Network/SDN/Fabrics.pm | 5 +++++ src/PVE/Network/SDN/Ipams/Plugin.pm | 5 +++++ src/PVE/Network/SDN/VnetPlugin.pm | 5 +++++ src/PVE/Network/SDN/Zones/Plugin.pm | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/src/PVE/Network/SDN/Controllers/Plugin.pm b/src/PVE/Network/SDN/Controllers/Plugin.pm index d70e518..f117f28 100644 --- a/src/PVE/Network/SDN/Controllers/Plugin.pm +++ b/src/PVE/Network/SDN/Controllers/Plugin.pm @@ -30,6 +30,11 @@ PVE::JSONSchema::register_format('pve-sdn-controller-id', \&parse_sdn_controller sub parse_sdn_controller_id { my ($id, $noerr) = @_; + if (length($id) < 2) { + return undef if $noerr; + die "controller ID '$id' can't be shorter than 2 characters\n"; + } + if ($id !~ m/^[a-z][a-z0-9_-]*[a-z0-9]$/i) { return undef if $noerr; die "controller ID '$id' contains illegal characters\n"; diff --git a/src/PVE/Network/SDN/Dns/Plugin.pm b/src/PVE/Network/SDN/Dns/Plugin.pm index 2864d4c..68a07fa 100644 --- a/src/PVE/Network/SDN/Dns/Plugin.pm +++ b/src/PVE/Network/SDN/Dns/Plugin.pm @@ -32,6 +32,11 @@ PVE::JSONSchema::register_format('pve-sdn-dns-id', \&parse_sdn_dns_id); sub parse_sdn_dns_id { my ($id, $noerr) = @_; + if (length($id) < 2) { + return undef if $noerr; + die "dns ID '$id' can't be shorter than 2 characters\n"; + } + if ($id !~ m/^[a-z][a-z0-9]*[a-z0-9]$/i) { return undef if $noerr; die "dns ID '$id' contains illegal characters\n"; diff --git a/src/PVE/Network/SDN/Fabrics.pm b/src/PVE/Network/SDN/Fabrics.pm index d90992a..b18ac7d 100644 --- a/src/PVE/Network/SDN/Fabrics.pm +++ b/src/PVE/Network/SDN/Fabrics.pm @@ -13,6 +13,11 @@ PVE::JSONSchema::register_format( sub { my ($id, $noerr) = @_; + if (length($id) > 8) { + return undef if $noerr; + die "Fabric ID '$id' can't be longer than 8 characters\n"; + } + if ($id !~ m/^[a-zA-Z0-9][a-zA-Z0-9-]{0,6}[a-zA-Z0-9]?$/i) { return undef if $noerr; die "Fabric ID '$id' contains illegal characters\n"; diff --git a/src/PVE/Network/SDN/Ipams/Plugin.pm b/src/PVE/Network/SDN/Ipams/Plugin.pm index a986a92..10aabea 100644 --- a/src/PVE/Network/SDN/Ipams/Plugin.pm +++ b/src/PVE/Network/SDN/Ipams/Plugin.pm @@ -33,6 +33,11 @@ PVE::JSONSchema::register_format('pve-sdn-ipam-id', \&parse_sdn_ipam_id); sub parse_sdn_ipam_id { my ($id, $noerr) = @_; + if (length($id) < 2) { + return undef if $noerr; + die "ipam ID '$id' can't be shorter than 2 characters\n"; + } + if ($id !~ m/^[a-z][a-z0-9]*[a-z0-9]$/i) { return undef if $noerr; die "ipam ID '$id' contains illegal characters\n"; diff --git a/src/PVE/Network/SDN/VnetPlugin.pm b/src/PVE/Network/SDN/VnetPlugin.pm index 717438c..a191af1 100644 --- a/src/PVE/Network/SDN/VnetPlugin.pm +++ b/src/PVE/Network/SDN/VnetPlugin.pm @@ -30,6 +30,11 @@ PVE::JSONSchema::register_format('pve-sdn-vnet-id', \&parse_sdn_vnet_id); sub parse_sdn_vnet_id { my ($id, $noerr) = @_; + if (length($id) < 2) { + return undef if $noerr; + die "vnet ID '$id' can't be shorter than 2 characters\n"; + } + if ($id !~ m/^[a-z][a-z0-9]*[a-z0-9]$/i) { return undef if $noerr; die "vnet ID '$id' contains illegal characters\n"; diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm index 826ebdf..14e2634 100644 --- a/src/PVE/Network/SDN/Zones/Plugin.pm +++ b/src/PVE/Network/SDN/Zones/Plugin.pm @@ -32,6 +32,11 @@ PVE::JSONSchema::register_format('pve-sdn-zone-id', \&parse_sdn_zone_id); sub parse_sdn_zone_id { my ($id, $noerr) = @_; + if (length($id) < 2) { + return undef if $noerr; + die "zone ID '$id' can't be shorter than 2 characters\n"; + } + if ($id !~ m/^[a-z][a-z0-9]*[a-z0-9]$/i) { return undef if $noerr; die "zone ID '$id' contains illegal characters\n"; -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel