public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report
@ 2026-11-01 21:34 13% Thomas Lamprecht
  2026-11-01 21:34 12% ` [PATCH common 03/10] schema: add helpers to redact sensitive values Thomas Lamprecht
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ results
From: Thomas Lamprecht @ 2026-11-01 21:34 UTC (permalink / raw)
  To: pve-devel

The system report only requires Sys.Audit, but contains all guest configs
and the SDN configs verbatim. So it includes cloud-init passwords, in plain
text for Windows guests, and the API tokens of SDN IPAM and DNS
integrations. A report is often sent to support by someone who does not
own these credentials, for example a hosting provider renting out VMs.

This series adds a 'sensitive' flag for schema properties and uses it to
redact the report:

 - pve-common gets the flag, and helpers that replace the values of
   flagged properties in the raw text of key/value and section config
   files. Working on the raw text keeps invalid lines visible, which are
   often what support needs to see.
 - qemu-server flags the cloud-init password, and no longer shows it in
   the warning about an unparsable config line. pve-network flags the
   IPAM and DNS tokens.
 - The report redacts guest, storage and SDN IPAM/DNS configs through
   their schemas. In the whole report it also replaces passwords in URLs
   and values whose name suggests a credential, like mount options and
   container environment variables. The pvereport man page lists what
   gets redacted and where credentials can remain.

The flag only declares a value as secret; it changes neither validation
nor how values are stored. It can later also drive generic masking of API
output and task logs.

If it looks alright in general I can then add support for this also on
the rust side, partially prepared here already locally. And we can then
also leverage this more, like midterm also do a slightly more elaborate
secret-store concept with the biggest benefit being an unified API and
potentially different backends (pmxcfs, simple file store) and (at rest)
encryption and so on.

Repo (build-)dependencies:
 qemu-server, pve-network, pve-manager -> pve-common
The report change only has an effect with the qemu-server and pve-network
patches applied.

pve-common:

Thomas Lamprecht (4):
  section config: do not add isolated property lists on lookups
  schema: allow marking properties as sensitive
  schema: add helpers to redact sensitive values
  section config: add redaction of sensitive values in raw configs

 src/PVE/JSONSchema.pm                         |  51 ++++++
 src/PVE/SectionConfig.pm                      |  51 +++++-
 test/json-schema-test.pl                      | 148 ++++++++++++++++++
 .../section_config_property_isolation_test.pl |  52 ++++++
 test/section_config_test.pl                   |  40 +++++
 5 files changed, 341 insertions(+), 1 deletion(-)

qemu-server:

Thomas Lamprecht (2):
  cloud-init: mark the password as sensitive
  config: hide sensitive values of unparsable lines in warnings

 src/PVE/QemuServer.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

pve-network:

Thomas Lamprecht (1):
  sdn: ipam, dns: mark API tokens as sensitive

 src/PVE/Network/SDN/Dns/PowerdnsPlugin.pm  | 1 +
 src/PVE/Network/SDN/Ipams/PhpIpamPlugin.pm | 1 +
 2 files changed, 2 insertions(+)

pve-manager:

Thomas Lamprecht (3):
  report: redact sensitive values from guest, storage and SDN configs
  report: redact credentials in URLs, options and environment variables
  pvereport: man page: document which values get redacted

 PVE/Report.pm       | 78 ++++++++++++++++++++++++++++++++++++++++-----
 bin/pvereport       | 31 ++++++++++++++++++
 test/Makefile       |  6 +++-
 test/report_test.pl | 78 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 184 insertions(+), 9 deletions(-)
 create mode 100755 test/report_test.pl

-- 
2.47.3





^ permalink raw reply	[relevance 13%]

* [PATCH common 04/10] section config: add redaction of sensitive values in raw configs
  2026-11-01 21:34 13% [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report Thomas Lamprecht
  2026-11-01 21:34 12% ` [PATCH common 03/10] schema: add helpers to redact sensitive values Thomas Lamprecht
@ 2026-11-01 21:34 10% ` Thomas Lamprecht
  2026-11-01 21:34 14% ` [PATCH manager 08/10] report: redact sensitive values from guest, storage and SDN configs Thomas Lamprecht
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ results
From: Thomas Lamprecht @ 2026-11-01 21:34 UTC (permalink / raw)
  To: pve-devel

Section config files like the SDN IPAM and DNS configs hold API tokens
and are included verbatim in the system report, so they need the same
raw-text redaction as key/value config files.

Sections are delimited as in parse_config, so each value is checked
against the schema of the section the parser assigns it to. Sections of
a type without a registered plugin are still checked against the
properties that are not isolated to a plugin.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
 src/PVE/SectionConfig.pm                      | 48 +++++++++++++++++++
 .../section_config_property_isolation_test.pl | 43 +++++++++++++++++
 test/section_config_test.pl                   | 40 ++++++++++++++++
 3 files changed, 131 insertions(+)

diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm
index 1febf76..04a79de 100644
--- a/src/PVE/SectionConfig.pm
+++ b/src/PVE/SectionConfig.pm
@@ -1807,6 +1807,54 @@ sub write_config {
     return $out;
 }
 
+=head3 $base->redact_raw_config(...)
+
+=head3 $base->redact_raw_config($raw, $placeholder)
+
+    $redacted = PVE::Example::BasePlugin->redact_raw_config($raw, $placeholder)
+    $redacted = $class->redact_raw_config($raw, $placeholder)
+
+Returns the contents of a C<L<PVE::SectionConfig>> file with the value of every
+property marked as C<sensitive> replaced by C<$placeholder>, including sensitive
+keys of property strings.
+
+Works on the raw text, so lines that
+C<L<< parse_config()|/$base->parse_config(...) >>> would skip as invalid are
+kept. As in C<L<< parse_config()|/$base->parse_config(...) >>>, a section ends
+at the next empty line. Outside of sections of a known
+I<L<< type|/$plugin->type() >>>, only properties that are not isolated to a
+plugin are recognized.
+
+=cut
+
+sub redact_raw_config($class, $raw, $placeholder) {
+    my ($type, $in_section) = ('', 0);
+    my @lines = split(/\n/, $raw, -1);
+    for my $line (@lines) {
+        next if $line =~ m/^\s*#/;
+
+        if ($line eq '') {
+            ($type, $in_section) = ('', 0);
+            next;
+        }
+
+        if (!$in_section) {
+            my ($header_type) = $class->parse_section_header($line);
+            if (defined($header_type)) {
+                ($type, $in_section) = ($header_type, 1);
+                next;
+            }
+        }
+
+        if (my ($prefix, $key, $value) = $line =~ m/^(\s+(\S+)\s+)(.*)$/) {
+            my $schema = $class->get_property_schema($type, $key) or next;
+            $line =
+                $prefix . PVE::JSONSchema::redact_sensitive_value($schema, $value, $placeholder);
+        }
+    }
+    return join("\n", @lines);
+}
+
 sub assert_if_modified {
     my ($cfg, $digest) = @_;
 
diff --git a/test/section_config_property_isolation_test.pl b/test/section_config_property_isolation_test.pl
index 11b3142..a487952 100755
--- a/test/section_config_property_isolation_test.pl
+++ b/test/section_config_property_isolation_test.pl
@@ -85,6 +85,7 @@ sub properties {
             description => 'Another field',
             type => 'string',
             optional => 1,
+            sensitive => 1,
         },
         arrayfield => {
             description => "Array Field with property string",
@@ -395,6 +396,7 @@ my sub make_schema($is_update) {
                                 description => 'Another field',
                                 type => 'string',
                                 optional => 1,
+                                sensitive => 1,
                             },
                             arrayfield => {
                                 description => "Array Field with property string",
@@ -481,6 +483,47 @@ ok(
     "property lookup does not add a property list",
 );
 
+my $redact_in = <<"EOF";
+one: a
+	another secret
+
+two: b
+	another visible
+
+unknown: c
+	another isolated
+
+two: d
+one: d-ignored
+	another visible
+
+one: e
+two: e-ignored
+	another secret
+	another
+EOF
+my $redact_out = <<"EOF";
+one: a
+	another <redacted>
+
+two: b
+	another visible
+
+unknown: c
+	another isolated
+
+two: d
+one: d-ignored
+	another visible
+
+one: e
+two: e-ignored
+	another <redacted>
+	another
+EOF
+is(Conf->redact_raw_config($redact_in, '<redacted>'), $redact_out,
+    "property-isolation redact test");
+
 done_testing();
 
 1;
diff --git a/test/section_config_test.pl b/test/section_config_test.pl
index 2cdff98..3e52834 100755
--- a/test/section_config_test.pl
+++ b/test/section_config_test.pl
@@ -75,6 +75,7 @@ sub properties {
         another => {
             description => 'Another field',
             type => 'string',
+            sensitive => 1,
         },
     };
 }
@@ -115,6 +116,7 @@ sub properties {
                     subfield1 => {
                         type => 'string',
                         description => 'first subfield',
+                        sensitive => 1,
                     },
                     subfield2 => {
                         type => 'integer',
@@ -300,6 +302,7 @@ my $expected_create_schema = {
                     'subfield1' => {
                         'description' => 'first subfield',
                         'type' => 'string',
+                        'sensitive' => 1,
                     },
                 },
                 'type' => 'string',
@@ -311,6 +314,7 @@ my $expected_create_schema = {
             'description' => 'Another field',
             'optional' => 1,
             'type' => 'string',
+            'sensitive' => 1,
         },
     },
 };
@@ -369,6 +373,7 @@ my $expected_update_schema = {
                     subfield1 => {
                         description => 'first subfield',
                         type => 'string',
+                        sensitive => 1,
                     },
                 },
             },
@@ -379,11 +384,46 @@ my $expected_update_schema = {
             description => 'Another field',
             optional => 1,
             type => 'string',
+            sensitive => 1,
         },
     },
 };
 is_deeply($update_schema, $expected_update_schema, "update schema test");
 
+my $redact_in = <<"EOF";
+one: t1
+	common foo
+	another secret1
+
+# another: comment
+two: t2
+	field2 5
+	another  secret2
+invalid line
+	arrayfield subfield2=2,subfield1=secret3
+
+bad: unknown
+	another secret4
+	unknownfield visible
+EOF
+my $redact_out = <<"EOF";
+one: t1
+	common foo
+	another <redacted>
+
+# another: comment
+two: t2
+	field2 5
+	another  <redacted>
+invalid line
+	arrayfield subfield2=2,subfield1=<redacted>
+
+bad: unknown
+	another <redacted>
+	unknownfield visible
+EOF
+is(Conf->redact_raw_config($redact_in, '<redacted>'), $redact_out, "redact raw config");
+
 done_testing();
 
 1;
-- 
2.47.3





^ permalink raw reply related	[relevance 10%]

* [PATCH manager 08/10] report: redact sensitive values from guest, storage and SDN configs
  2026-11-01 21:34 13% [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report Thomas Lamprecht
  2026-11-01 21:34 12% ` [PATCH common 03/10] schema: add helpers to redact sensitive values Thomas Lamprecht
  2026-11-01 21:34 10% ` [PATCH common 04/10] section config: add redaction of sensitive values in raw configs Thomas Lamprecht
@ 2026-11-01 21:34 14% ` Thomas Lamprecht
  2026-11-13 18:14 10% ` [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report Max R. Carrara
  2026-11-16 11:00  7% ` applied: " Thomas Lamprecht
  4 siblings, 0 replies; 6+ results
From: Thomas Lamprecht @ 2026-11-01 21:34 UTC (permalink / raw)
  To: pve-devel

The system report only requires Sys.Audit, but includes all guest
configs and the SDN configs verbatim. So it contains cloud-init
passwords, in plain text for Windows guests, and the API tokens of SDN
IPAM and DNS integrations, while the config API masks the password for
everyone. A report is often sent to support by someone who does not own
these credentials, for example a hosting provider renting out VMs.

Replace the values of all properties marked as sensitive in their
schema, in every section including snapshots and pending changes. The
key stays visible, and so does every other line of the file, including
invalid ones.

storage.cfg holds no secrets of the built-in plugins, which store them
in separate files, but third-party plugins that keep credentials inline
can now mark them and have them redacted too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
NOTE: needs a libpve-common-perl with the raw config redaction helpers
as a hard runtime dependency; with an older one the report shows errors
instead of the guest, storage and SDN configs. The redaction only takes
effect with qemu-server and libpve-network-perl versions that mark their
secrets.

 PVE/Report.pm | 56 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 49 insertions(+), 7 deletions(-)

diff --git a/PVE/Report.pm b/PVE/Report.pm
index e255d538f..7182c091d 100644
--- a/PVE/Report.pm
+++ b/PVE/Report.pm
@@ -4,11 +4,27 @@ use strict;
 use warnings;
 
 use PVE::IPRoute2;
+use PVE::JSONSchema;
+use PVE::LXC::Config;
+use PVE::Network::SDN::Dns;
+use PVE::Network::SDN::Ipams;
+use PVE::QemuServer;
+use PVE::Storage;
 use PVE::Tools;
 
+my $redaction_placeholder = '<redacted>';
+
+my sub file2text {
+    my ($path, $redact) = @_;
+
+    my $content = PVE::Tools::file_get_contents($path);
+    $content = $redact->($content, $path) if $redact;
+    return "\n# cat $path\n$content\n";
+}
+
 # output the content of all the files of a directory
 my sub dir2text {
-    my ($target_dir, $regexp) = @_;
+    my ($target_dir, $regexp, $redact) = @_;
 
     print STDERR "dir2text '${target_dir}${regexp}'...";
     my $text = "# output '${target_dir}${regexp}' file(s)\n";
@@ -18,13 +34,39 @@ my sub dir2text {
         sub {
             my ($file) = @_;
             return if $file eq '.' || $file eq '..';
-            $text .= "\n# cat $target_dir$file\n";
-            $text .= PVE::Tools::file_get_contents($target_dir . $file) . "\n";
+            $text .= file2text($target_dir . $file, $redact);
         },
     );
     return $text;
 }
 
+my sub redact_qemu_config {
+    my ($raw) = @_;
+
+    my $schema = { type => 'object', properties => PVE::QemuServer::json_config_properties({}) };
+    return PVE::JSONSchema::redact_raw_config($schema, $raw, $redaction_placeholder);
+}
+
+my sub redact_lxc_config {
+    my ($raw) = @_;
+
+    my $schema = { type => 'object', properties => PVE::LXC::Config->json_config_properties({}) };
+    return PVE::JSONSchema::redact_raw_config($schema, $raw, $redaction_placeholder);
+}
+
+my $section_configs = {
+    '/etc/pve/sdn/dns.cfg' => 'PVE::Network::SDN::Dns::Plugin',
+    '/etc/pve/sdn/ipams.cfg' => 'PVE::Network::SDN::Ipams::Plugin',
+    '/etc/pve/storage.cfg' => 'PVE::Storage::Plugin',
+};
+
+my sub redact_section_config {
+    my ($raw, $path) = @_;
+
+    my $class = $section_configs->{$path} // return $raw;
+    return $class->redact_raw_config($raw, $redaction_placeholder);
+}
+
 # command -v is the posix equivalent of 'which'
 my sub cmd_exists { system("command -v '$_[0]' > /dev/null 2>&1") == 0 }
 
@@ -59,7 +101,7 @@ my $init_report_cmds = sub {
         storage => {
             order => 30,
             cmds => [
-                'cat /etc/pve/storage.cfg',
+                sub { file2text('/etc/pve/storage.cfg', \&redact_section_config) },
                 'pvesm status',
                 'cat /etc/fstab',
                 'findmnt --ascii',
@@ -71,9 +113,9 @@ my $init_report_cmds = sub {
             order => 40,
             cmds => [
                 'qm list',
-                sub { dir2text('/etc/pve/qemu-server/', '\d+\.conf') },
+                sub { dir2text('/etc/pve/qemu-server/', '\d+\.conf', \&redact_qemu_config) },
                 'pct list',
-                sub { dir2text('/etc/pve/lxc/', '\d+\.conf') },
+                sub { dir2text('/etc/pve/lxc/', '\d+\.conf', \&redact_lxc_config) },
             ],
         },
         network => {
@@ -85,7 +127,7 @@ my $init_report_cmds = sub {
                 'cat /etc/network/interfaces',
                 sub { dir2text('/etc/network/interfaces.d/', '.*') },
                 'cat /etc/pve/sdn/.running-config',
-                sub { dir2text('/etc/pve/sdn/', '.+\.cfg') },
+                sub { dir2text('/etc/pve/sdn/', '.+\.cfg', \&redact_section_config) },
                 sub { dir2text('/etc/pve/sdn/', '.+\.json') },
             ],
         },
-- 
2.47.3





^ permalink raw reply related	[relevance 14%]

* [PATCH common 03/10] schema: add helpers to redact sensitive values
  2026-11-01 21:34 13% [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report Thomas Lamprecht
@ 2026-11-01 21:34 12% ` Thomas Lamprecht
  2026-11-01 21:34 10% ` [PATCH common 04/10] section config: add redaction of sensitive values in raw configs Thomas Lamprecht
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ results
From: Thomas Lamprecht @ 2026-11-01 21:34 UTC (permalink / raw)
  To: pve-devel

The system report includes config files verbatim. Redacting them by
parsing and writing them out again would drop or normalize invalid
lines, which are often what support needs to see. So redaction works on
the raw text of key/value config files and only replaces the values of
properties marked as sensitive, in every section of the file. For
property strings only the sensitive keys are replaced, the rest of the
value stays readable. Empty values are kept, as they reveal nothing and
help to spot configuration errors.

The value helper also takes parsed values, including array references
and unset values, so it can be reused for masking API output.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
 src/PVE/JSONSchema.pm    |  43 ++++++++++++
 test/json-schema-test.pl | 148 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 191 insertions(+)

diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index e4225df..12ef6c2 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -2656,6 +2656,49 @@ sub dump_config {
     return $data;
 }
 
+sub redact_sensitive_value($schema, $value, $placeholder) {
+    return $value if !defined($value);
+    return [map { redact_sensitive_value($schema, $_, $placeholder) } $value->@*]
+        if ref($value) eq 'ARRAY';
+    return $value if $value !~ m/\S/;
+    return $placeholder if $schema->{sensitive};
+    return redact_sensitive_value($schema->{items}, $value, $placeholder) if $schema->{items};
+
+    my $format = $schema->{format};
+    $format = get_format($format) if defined($format) && !ref($format);
+    return $value if ref($format) ne 'HASH';
+
+    my ($default_key) = grep { $format->{$_}->{default_key} } keys $format->%*;
+    my $key_schema = sub($key) {
+        my $key_schema = $format->{$key} // return;
+        return defined($key_schema->{alias}) ? $format->{ $key_schema->{alias} } : $key_schema;
+    };
+
+    my @parts = split(/,/, $value, -1);
+    for my $part (@parts) {
+        if (my ($key, $key_value) = $part =~ m/^([^=]+)=(.*)$/) {
+            my $schema = $key_schema->($key) or next;
+            $part = "$key=" . redact_sensitive_value($schema, $key_value, $placeholder);
+        } elsif (defined($default_key)) {
+            $part = redact_sensitive_value($format->{$default_key}, $part, $placeholder);
+        }
+    }
+    return join(',', @parts);
+}
+
+sub redact_raw_config($schema, $raw, $placeholder) {
+    my $props = $schema->{properties} or die "got strange schema\n";
+
+    my @lines = split(/\n/, $raw, -1);
+    for my $line (@lines) {
+        my ($prefix, $key, $value) = $line =~ m/^(\s*(\S+?):\s*)(.*)$/ or next;
+        my $prop = $props->{$key} or next;
+        $prop = $props->{ $prop->{alias} } // next if defined($prop->{alias});
+        $line = $prefix . redact_sensitive_value($prop, $value, $placeholder);
+    }
+    return join("\n", @lines);
+}
+
 # helpers used to generate our manual pages
 
 my $find_schema_default_key = sub {
diff --git a/test/json-schema-test.pl b/test/json-schema-test.pl
index f1c968f..28c8efd 100755
--- a/test/json-schema-test.pl
+++ b/test/json-schema-test.pl
@@ -863,4 +863,152 @@ for my $test ($check_one_of->@*) {
     };
 }
 
+PVE::JSONSchema::register_format(
+    'test-redact',
+    {
+        name => { type => 'string', default_key => 1, optional => 1 },
+        secret => { type => 'string', sensitive => 1, optional => 1 },
+        'old-secret' => { alias => 'secret' },
+    },
+);
+
+my $redact_value_tests = [
+    {
+        name => 'sensitive value',
+        schema => { type => 'string', sensitive => 1 },
+        in => 'hunter2',
+        out => '***',
+    },
+    {
+        name => 'other value',
+        schema => { type => 'string' },
+        in => 'visible',
+        out => 'visible',
+    },
+    {
+        name => 'sensitive sub-key',
+        schema => { type => 'string', format => 'test-redact' },
+        in => 'name=foo,secret=bar',
+        out => 'name=foo,secret=***',
+    },
+    {
+        name => 'sensitive sub-key via alias',
+        schema => { type => 'string', format => 'test-redact' },
+        in => 'foo,old-secret=bar',
+        out => 'foo,old-secret=***',
+    },
+    {
+        name => 'sensitive default key',
+        schema => {
+            type => 'string',
+            format => { secret => { type => 'string', default_key => 1, sensitive => 1 } },
+        },
+        in => 'bar,,',
+        out => '***,,',
+    },
+    {
+        name => 'format without sensitive sub-keys',
+        schema => { type => 'string', format => { name => { type => 'string' } } },
+        in => 'not=a,valid',
+        out => 'not=a,valid',
+    },
+    {
+        name => 'empty sensitive value',
+        schema => { type => 'string', sensitive => 1 },
+        in => '',
+        out => '',
+    },
+    {
+        name => 'nested format',
+        schema => {
+            type => 'string',
+            format => {
+                inner => { type => 'string', format => 'test-redact' },
+                other => { type => 'string' },
+            },
+        },
+        in => 'other=x,inner=secret=bar',
+        out => 'other=x,inner=secret=***',
+    },
+    {
+        name => 'unset value',
+        schema => { type => 'string', sensitive => 1 },
+        in => undef,
+        out => undef,
+    },
+    {
+        name => 'array item',
+        schema => { type => 'array', items => { type => 'string', format => 'test-redact' } },
+        in => 'foo,secret=bar',
+        out => 'foo,secret=***',
+    },
+    {
+        name => 'array of items',
+        schema => { type => 'array', items => { type => 'string', format => 'test-redact' } },
+        in => ['foo,secret=bar', 'baz'],
+        out => ['foo,secret=***', 'baz'],
+    },
+    {
+        name => 'sensitive array',
+        schema => { type => 'array', sensitive => 1, items => { type => 'string' } },
+        in => ['foo', 'bar'],
+        out => ['***', '***'],
+    },
+];
+
+for my $test ($redact_value_tests->@*) {
+    my $res = PVE::JSONSchema::redact_sensitive_value($test->{schema}, $test->{in}, '***');
+    is_deeply($res, $test->{out}, "redact $test->{name}");
+}
+
+my $redact_config_schema = {
+    type => 'object',
+    properties => {
+        password => { type => 'string', sensitive => 1 },
+        'old-password' => { type => 'string', alias => 'password' },
+        options => { type => 'string', format => 'test-redact' },
+        name => { type => 'string' },
+        tokens => { type => 'array', items => { type => 'string', sensitive => 1 } },
+    },
+};
+my $redact_config_in = <<'EOF';
+#password: in a comment
+password: hunter2
+old-password: aliased
+options: foo,secret=bar
+name: visible
+tokens: first
+tokens: second
+invalid line
+
+[snapshot]
+  password:   older
+[special:cloudinit]
+password: applied
+password:
+EOF
+my $redact_config_out = <<'EOF';
+#password: in a comment
+password: ***
+old-password: ***
+options: foo,secret=***
+name: visible
+tokens: ***
+tokens: ***
+invalid line
+
+[snapshot]
+  password:   ***
+[special:cloudinit]
+password: ***
+password:
+EOF
+is(
+    PVE::JSONSchema::redact_raw_config($redact_config_schema, $redact_config_in, '***'),
+    $redact_config_out,
+    'redact key/value config',
+);
+eval { PVE::JSONSchema::redact_raw_config({ type => 'object' }, $redact_config_in, '***') };
+like($@, qr/strange schema/, 'redact key/value config fails without properties');
+
 done_testing();
-- 
2.47.3





^ permalink raw reply related	[relevance 12%]

* Re: [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report
  2026-11-01 21:34 13% [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report Thomas Lamprecht
                   ` (2 preceding siblings ...)
  2026-11-01 21:34 14% ` [PATCH manager 08/10] report: redact sensitive values from guest, storage and SDN configs Thomas Lamprecht
@ 2026-11-13 18:14 10% ` Max R. Carrara
  2026-11-16 11:00  7% ` applied: " Thomas Lamprecht
  4 siblings, 0 replies; 6+ results
From: Max R. Carrara @ 2026-11-13 18:14 UTC (permalink / raw)
  To: Thomas Lamprecht, pve-devel

On Sun Nov 1, 2026 at 10:34 PM CET, Thomas Lamprecht wrote:
> The system report only requires Sys.Audit, but contains all guest configs
> and the SDN configs verbatim. So it includes cloud-init passwords, in plain
> text for Windows guests, and the API tokens of SDN IPAM and DNS
> integrations. A report is often sent to support by someone who does not
> own these credentials, for example a hosting provider renting out VMs.
>
> This series adds a 'sensitive' flag for schema properties and uses it to
> redact the report [...]

Haven't found anything off. The only sus thing is that `git am -3`
fumbles applying patch #7; the conflict is trivial to fix.

Did some basic smoke-testing; the `pvereport` on my dev machine doesn't
look any different than before, since there are no sensitive properties
declared anywhere.

For storage, we'd have to deprecate the `sensitive-properties` key in
`plugindata()` together with `::Plugin::sensitive_properties()` at some
point, because these properties are currently not taken into account.

When slapping a new property for testing purposes into the SSHFS plugin
and marking it as sensitive like the series describes, the property does
get redacted as expected in `pvereport`. Neat.

As mentioned above, if I remove `sensitive => 1` and add it to the
`sensitive-properties` key in `plugindata()`, it obviously does not get
redacted. This is painfully obvious from the diffs, but wanted to check
this again explicitly anyway.

LGTM.

Consider:

Reviewed-by: Max R. Carrara <m.carrara@proxmox.com>
Tested-by: Max R. Carrara <m.carrara@proxmox.com>





^ permalink raw reply	[relevance 10%]

* applied: [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report
  2026-11-01 21:34 13% [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report Thomas Lamprecht
                   ` (3 preceding siblings ...)
  2026-11-13 18:14 10% ` [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report Max R. Carrara
@ 2026-11-16 11:00  7% ` Thomas Lamprecht
  4 siblings, 0 replies; 6+ results
From: Thomas Lamprecht @ 2026-11-16 11:00 UTC (permalink / raw)
  To: pve-devel

Am 01.11.26 um 22:38 schrieb Thomas Lamprecht:
> The system report only requires Sys.Audit, but contains all guest configs
> and the SDN configs verbatim. So it includes cloud-init passwords, in plain
> text for Windows guests, and the API tokens of SDN IPAM and DNS
> integrations. A report is often sent to support by someone who does not
> own these credentials, for example a hosting provider renting out VMs.
> 
applied with Max R-b and T-b and some fixups and follow-ups in there, thanks!




^ permalink raw reply	[relevance 7%]

Results 1-6 of 6 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2026-11-01 21:34 13% [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report Thomas Lamprecht
2026-11-01 21:34 12% ` [PATCH common 03/10] schema: add helpers to redact sensitive values Thomas Lamprecht
2026-11-01 21:34 10% ` [PATCH common 04/10] section config: add redaction of sensitive values in raw configs Thomas Lamprecht
2026-11-01 21:34 14% ` [PATCH manager 08/10] report: redact sensitive values from guest, storage and SDN configs Thomas Lamprecht
2026-11-13 18:14 10% ` [PATCH common,qemu-server,network,manager 0/10] mark secrets in schemas and redact them from the system report Max R. Carrara
2026-11-16 11:00  7% ` applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal