public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [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

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 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