From 427c687e35d964d881a6de6a38c841d0ac7f3043 Mon Sep 17 00:00:00 2001 From: Gabriel Goller Date: Thu, 10 Apr 2025 10:20:52 +0200 Subject: [PATCH] restrict consent-banner text length Add a maxLength in of 64*1024 in the frontend and the api. We allow a max body size of 512*1024 in the api (with patch [0]) so we should be fine. [0]: https://git.proxmox.com/?p=proxmox.git;a=commit;h=cf9e6c03a092acf8808ce83dad9249414fe4d588 Signed-off-by: Gabriel Goller Link: https://lore.proxmox.com/20250410082052.53097-1-g.goller@proxmox.com --- src/config/node.rs | 5 +++++ www/config/NodeOptionView.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/config/node.rs b/src/config/node.rs index 2b29cb02..fb6b182d 100644 --- a/src/config/node.rs +++ b/src/config/node.rs @@ -174,6 +174,11 @@ pub enum Translation { "description" : { optional: true, schema: MULTI_LINE_COMMENT_SCHEMA, + }, + "consent-text" : { + optional: true, + type: String, + max_length: 64 * 1024, } }, )] diff --git a/www/config/NodeOptionView.js b/www/config/NodeOptionView.js index c327356f..5fd17d80 100644 --- a/www/config/NodeOptionView.js +++ b/www/config/NodeOptionView.js @@ -59,6 +59,9 @@ Ext.define('PBS.NodeOptionView', { name: 'consent-text', text: gettext('Consent Text'), deleteEmpty: true, + fieldOpts: { + maxLength: 64 * 1024, + }, onlineHelp: 'consent_banner', }, ],