From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id DF92A1FF0B3 for ; Thu, 26 Nov 2026 10:18:02 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 71DD6216E9; Thu, 26 Nov 2026 10:17:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dualfroz.com; s=dkim; t=1795684668; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding; bh=AUo7UGhFGfTAZiBFNlxrPSicCrNldSB15fUwcamBl+A=; b=FaK0BZ9x2ZIaQ+bNFpsLinKjPWMz352/Vneol1EjLS8l896ThfB5kX6qL3KNclYtOS6wxm SFYgLmZ81I9pOHuITyAMo6gJn8yGeHIcHTGuzh4S+RhJ1al787px/1nobFhuH9Ybq60N+3 vLhOrUCQpAzpOryWeoznT00VEkX9gR3zEgU7lyVBoSNACJvEnW3iottQa0PnjgmCmtxah9 Wr0PNsgE/2OaZ/58SCQFhN9s8VzYeg/8vi5pi/WSISSW+dHJCzG8smw1KQfpYFYUI9h6ud +QxvSlqyYfvhLgIwfoJNlQ7qfJvSPIHEvBN696RKzu1FE7qCxoF/PmqjypZ4LQ== From: Michal Fox To: pve-devel@lists.proxmox.com Subject: [PATCH common] fix #5607: json schema: describe the allowed characters of configuration IDs Date: Thu, 26 Nov 2026 09:17:45 +0000 Message-ID: <20261126091745.7-1-me@dualfroz.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.121 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: NYOZFJQSOAJ75Q25OUZ5KJUSWYSOBMCP X-Message-ID-Hash: NYOZFJQSOAJ75Q25OUZ5KJUSWYSOBMCP X-MailFrom: me@dualfroz.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: An ID that does not match the pve-configid format, for example the name of a resource mapping, is rejected with just "invalid configuration ID", so users have to guess what is wrong with it. Spell out the rule in the error message and add a test for it. Signed-off-by: Michal Fox --- tested with make check, the new test fails without the change src/PVE/JSONSchema.pm | 3 ++- test/format_test.pl | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index 41210b7..5d2b7d4 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -256,7 +256,8 @@ sub pve_verify_configid { if ($id !~ m/^$CONFIGID_RE\z/) { return undef if $noerr; - die "invalid configuration ID '$id'\n"; + die "invalid configuration ID '$id' - must start with a letter and be followed by" + . " at least one letter, digit, '-' or '_'\n"; } return $id; } diff --git a/test/format_test.pl b/test/format_test.pl index 2b9460d..f2993a9 100755 --- a/test/format_test.pl +++ b/test/format_test.pl @@ -26,6 +26,9 @@ foreach my $id (@$invalid_configids) { is(PVE::JSONSchema::pve_verify_configid($id, $noerr), undef, 'invalid configid'); } +eval { PVE::JSONSchema::pve_verify_configid('1a') }; +like($@, qr/must start with a letter/, 'invalid configid error describes the allowed characters'); + # test some string rendering my $render_data = [ ["timestamp", 0, undef, "1970-01-01 01:00:00"], -- 2.43.0