From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 6C9691FF0B2 for ; Wed, 19 Aug 2026 11:50:31 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2367A21530; Wed, 19 Aug 2026 11:50:29 +0200 (CEST) From: Arthur Bied-Charreton To: pve-devel@lists.proxmox.com Subject: [PATCH pve-manager] fix #7942: pvesh: treat schema without properties as empty object Date: Wed, 19 Aug 2026 11:50:23 +0200 Message-ID: <20260819095023.329117-1-a.bied-charreton@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.765 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RDNS_NONE 1.274 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 Message-ID-Hash: U42MRL6PIBXJWWTYVS773XSVUQDHV4FE X-Message-ID-Hash: U42MRL6PIBXJWWTYVS773XSVUQDHV4FE X-MailFrom: abied-charreton@jett.proxmox.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: merge_properties() dispatches on the shape of the target schema by merging into `properties` if present, appending to an `allOf` list, or wrapping a `oneOf` into a new `allOf`. A schema with none of those entries died on the assumption that it is not an object. A lot of endpoints (e.g., /cluster/firewall/options, /cluster/notifications/matcher-field-values) across our api define the parameters schema as follows: { additionalProperties => 0 } Before 874d160f317a, pvesh treated this as a valid schema allowing no parameters. Since that commit, it fails while loading with the following error: unknown schema type (not an object?) Split the fallback branch into the three cases that can reach it: die with the offending type if the schema is explicitly not an object, die with the offending keys if it contains unexpected keys, otherwise treat `$to` as a valid, empty object and populate `properties` directly. Fixes: 874d160f317a ("pvesh: support for allOf/oneOf parameter schemas") Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=7942 Signed-off-by: Arthur Bied-Charreton --- PVE/CLI/pvesh.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/PVE/CLI/pvesh.pm b/PVE/CLI/pvesh.pm index 0ff481d4..9568e22b 100755 --- a/PVE/CLI/pvesh.pm +++ b/PVE/CLI/pvesh.pm @@ -304,6 +304,12 @@ my $our_properties = { }, }; +my sub unknown_schema_keys { + my ($schema) = @_; + + return [grep { $_ ne 'additionalProperties' && $_ ne 'type' } keys $schema->%*]; +} + my sub merge_properties { my ($from, $to) = @_; @@ -323,7 +329,14 @@ my sub merge_properties { my $old = { $to->%* }; $to->%* = (allOf => [$old, $from]); } else { - die "unknown schema type (not an object?)\n"; + die "unknown schema type '$to->{type}' (not an object)\n" + if defined($to->{type}) && $to->{type} ne 'object'; + + my $unknown = unknown_schema_keys($to); + die "unknown schema type, found unexpected keys: " . join(', ', sort($unknown->@*)) . "\n" + if $unknown->@*; + + $to->{properties} = { $from->{properties}->%* }; } } -- 2.47.3