* [PATCH pve-firewall 1/1] fix #7818: disallow line feeds in firewall comments
@ 2026-07-15 9:34 Stefan Hanreich
2026-07-15 9:48 ` Stoiko Ivanov
2026-07-15 10:11 ` superseded: " Stefan Hanreich
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Hanreich @ 2026-07-15 9:34 UTC (permalink / raw)
To: pve-devel
They do not get sanitized and interpreted literally, allowing for
authenticated users to inject additional lines into the firewall
configuration files.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
Notes:
Did quickly check the other properties as well, but couldn't find
anything. Will take a closer look still but wanted to get the patch
ready in the meanwhile.
src/PVE/Firewall.pm | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index 93f8c34..894a87b 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -1228,6 +1228,18 @@ sub pve_fw_verify_icmp_type_spec {
return $icmp_type;
}
+PVE::JSONSchema::register_format('pve-fw-comment-spec', \&pve_fw_verify_comment_spec);
+
+sub pve_fw_verify_comment_spec {
+ my ($comment) = @_;
+
+ if ($comment =~ m/[\n\r]/) {
+ die "comment must not contain a line feed\n";
+ }
+
+ return $comment;
+}
+
# helper function for API
sub copy_opject_with_digest {
@@ -1623,6 +1635,7 @@ my $rule_properties = {
description => "Descriptive comment.",
type => 'string',
optional => 1,
+ format => 'pve-fw-comment-spec',
},
'icmp-type' => {
description =>
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH pve-firewall 1/1] fix #7818: disallow line feeds in firewall comments
2026-07-15 9:34 [PATCH pve-firewall 1/1] fix #7818: disallow line feeds in firewall comments Stefan Hanreich
@ 2026-07-15 9:48 ` Stoiko Ivanov
2026-07-15 10:11 ` Stefan Hanreich
2026-07-15 10:11 ` superseded: " Stefan Hanreich
1 sibling, 1 reply; 4+ messages in thread
From: Stoiko Ivanov @ 2026-07-15 9:48 UTC (permalink / raw)
To: Stefan Hanreich; +Cc: pve-devel
Thanks for tackling this so quickly!
On Wed, 15 Jul 2026 11:34:30 +0200
Stefan Hanreich <s.hanreich@proxmox.com> wrote:
> They do not get sanitized and interpreted literally, allowing for
> authenticated users to inject additional lines into the firewall
> configuration files.
>
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
>
> Notes:
> Did quickly check the other properties as well, but couldn't find
> anything. Will take a closer look still but wanted to get the patch
> ready in the meanwhile.
>
> src/PVE/Firewall.pm | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
> index 93f8c34..894a87b 100644
> --- a/src/PVE/Firewall.pm
> +++ b/src/PVE/Firewall.pm
> @@ -1228,6 +1228,18 @@ sub pve_fw_verify_icmp_type_spec {
> return $icmp_type;
> }
>
> +PVE::JSONSchema::register_format('pve-fw-comment-spec', \&pve_fw_verify_comment_spec);
> +
> +sub pve_fw_verify_comment_spec {
> + my ($comment) = @_;
> +
> + if ($comment =~ m/[\n\r]/) {
suggestion: would restrict this here to printable characters
and exclude any vertical space:
https://perldoc.perl.org/perlunicode#%5Cp%7BPrint%7D
https://perldoc.perl.org/perlunicode#%5Cp%7BVertSpace%7D
as I'd not expect people to use control-chars in their comments
(of course that's breaking backward-compat a bit more)
> + die "comment must not contain a line feed\n";
> + }
> +
> + return $comment;
> +}
> +
> # helper function for API
>
> sub copy_opject_with_digest {
> @@ -1623,6 +1635,7 @@ my $rule_properties = {
> description => "Descriptive comment.",
> type => 'string',
> optional => 1,
> + format => 'pve-fw-comment-spec',
> },
> 'icmp-type' => {
> description =>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH pve-firewall 1/1] fix #7818: disallow line feeds in firewall comments
2026-07-15 9:48 ` Stoiko Ivanov
@ 2026-07-15 10:11 ` Stefan Hanreich
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hanreich @ 2026-07-15 10:11 UTC (permalink / raw)
To: Stoiko Ivanov; +Cc: pve-devel
On 7/15/26 11:48 AM, Stoiko Ivanov wrote:
[snip]
>> +sub pve_fw_verify_comment_spec {
>> + my ($comment) = @_;
>> +
>> + if ($comment =~ m/[\n\r]/) {
> suggestion: would restrict this here to printable characters
> and exclude any vertical space:
> https://perldoc.perl.org/perlunicode#%5Cp%7BPrint%7D
> https://perldoc.perl.org/perlunicode#%5Cp%7BVertSpace%7D
>
> as I'd not expect people to use control-chars in their comments
> (of course that's breaking backward-compat a bit more)
Yeah, should've thought of that initially as well - sent a v2 addressing
that.
^ permalink raw reply [flat|nested] 4+ messages in thread
* superseded: [PATCH pve-firewall 1/1] fix #7818: disallow line feeds in firewall comments
2026-07-15 9:34 [PATCH pve-firewall 1/1] fix #7818: disallow line feeds in firewall comments Stefan Hanreich
2026-07-15 9:48 ` Stoiko Ivanov
@ 2026-07-15 10:11 ` Stefan Hanreich
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hanreich @ 2026-07-15 10:11 UTC (permalink / raw)
To: pve-devel
https://lore.proxmox.com/pve-devel/20260715101054.31295-1-s.hanreich@proxmox.com/T/#u
On 7/15/26 11:34 AM, Stefan Hanreich wrote:
> They do not get sanitized and interpreted literally, allowing for
> authenticated users to inject additional lines into the firewall
> configuration files.
>
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
>
> Notes:
> Did quickly check the other properties as well, but couldn't find
> anything. Will take a closer look still but wanted to get the patch
> ready in the meanwhile.
>
> src/PVE/Firewall.pm | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
> index 93f8c34..894a87b 100644
> --- a/src/PVE/Firewall.pm
> +++ b/src/PVE/Firewall.pm
> @@ -1228,6 +1228,18 @@ sub pve_fw_verify_icmp_type_spec {
> return $icmp_type;
> }
>
> +PVE::JSONSchema::register_format('pve-fw-comment-spec', \&pve_fw_verify_comment_spec);
> +
> +sub pve_fw_verify_comment_spec {
> + my ($comment) = @_;
> +
> + if ($comment =~ m/[\n\r]/) {
> + die "comment must not contain a line feed\n";
> + }
> +
> + return $comment;
> +}
> +
> # helper function for API
>
> sub copy_opject_with_digest {
> @@ -1623,6 +1635,7 @@ my $rule_properties = {
> description => "Descriptive comment.",
> type => 'string',
> optional => 1,
> + format => 'pve-fw-comment-spec',
> },
> 'icmp-type' => {
> description =>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-15 10:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 9:34 [PATCH pve-firewall 1/1] fix #7818: disallow line feeds in firewall comments Stefan Hanreich
2026-07-15 9:48 ` Stoiko Ivanov
2026-07-15 10:11 ` Stefan Hanreich
2026-07-15 10:11 ` superseded: " Stefan Hanreich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.