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 905211FF0AF for ; Fri, 06 Nov 2026 16:46:35 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id ABA67216E8; Fri, 06 Nov 2026 16:46:16 +0100 (CET) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage v4 04/17] api: plugins/storage/plugin: mark sensitive properties in schema Date: Fri, 6 Nov 2026 16:45:40 +0100 Message-ID: <20261106154554.2182986-5-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261106154554.2182986-1-m.carrara@proxmox.com> References: <20261106154554.2182986-1-m.carrara@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793979963207 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.337 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) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: W2RPJZBLC26VIYKEL4XEXTW4SVNP56D7 X-Message-ID-Hash: W2RPJZBLC26VIYKEL4XEXTW4SVNP56D7 X-MailFrom: m.carrara@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 CC: Alfonso Kuen , Thomas Ellmenreich , Jakob Klocker X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Return a new 'x-sensitive' key as part of a plugin property's schema. Take the information for this key from the same helper that the storage config API uses to decide which parameters are sensitive. For plugins without a 'sensitive-properties' hash in their `plugindata()`, this helper falls back to a hardcoded list of properties. Otherwise, a custom plugin reusing e.g. the 'password' property would get a plain text field in the UI, although the API treats it as sensitive. Always set the key to either 0 or 1, so that the returned schema has the same shape for every property. Signed-off-by: Max R. Carrara --- src/PVE/API2/Plugins/Storage/Plugin.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PVE/API2/Plugins/Storage/Plugin.pm b/src/PVE/API2/Plugins/Storage/Plugin.pm index 07909c40..12da9a12 100644 --- a/src/PVE/API2/Plugins/Storage/Plugin.pm +++ b/src/PVE/API2/Plugins/Storage/Plugin.pm @@ -40,20 +40,24 @@ my sub get_schema_for_plugin : prototype($) ($plugin) { my $type = $plugin->type(); return $PLUGIN_SCHEMAS->{$type} if defined($PLUGIN_SCHEMAS->{$type}); my $options = $plugin->options(); + # also covers the fallback for plugins without 'sensitive-properties' in their plugindata() + my $sensitive = { map { $_ => 1 } PVE::Storage::Plugin::sensitive_properties($type)->@* }; my $schema = {}; $PLUGIN_SCHEMAS->{$type} = $schema; for my $option (keys $options->%*) { my $prop_schema = PVE::RESTHandler::api_dump_remove_refs( PVE::Storage::Plugin->get_property_schema($type, $option)); # shallow copy my $property = { $prop_schema->%* }; + $property->{'x-sensitive'} = $sensitive->{$option} ? 1 : 0; + $schema->{$option} = $property; for my $opt_key (keys $options->{$option}->%*) { $property->{$opt_key} = $options->{$option}->{$opt_key}; } -- 2.47.3