From: Robert Obkircher <r.obkircher@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH v1 proxmox-backup] www: percent-encode maintenance mode message to allow commas
Date: Thu, 26 Mar 2026 14:46:57 +0100 [thread overview]
Message-ID: <20260326134854.176430-1-r.obkircher@proxmox.com> (raw)
Commas and equal signs caused problems because the maintenance mode
message is stored in a property string.
With a comma and no quotes (e.g. 'a,b'), the backend failed to update
datastore.cfg because 'read-only,message=a,b' couldn't be re-parsed.
Adding a quote triggered the correct escape logic in the backend, but
then the frontend displayed the mode and message incorrectly. It also
cut off everything after the first equal sign and silently stripped
backslashes.
Percent encoding was chosen because MaintenanceMode::check already
decoded the message. Previously, this potentially caused the error
message to differ from what was displayed in the web UI.
Signed-off-by: Robert Obkircher <r.obkircher@proxmox.com>
---
I'm not sure if this is a good idea or if we should simply forbid those
characters.
I also tried changing ElementSerializer::serialize_str to quote like
ElementSerializeSeq, but that wouldn't be sufficient because the parser
in the frontend would still split by comma and parse something like
'read-only,message="a,b"' as type 'b"' and message '"a'.
www/Utils.js | 6 +++++-
www/window/MaintenanceOptions.js | 5 ++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/www/Utils.js b/www/Utils.js
index fc9a5916..5e1ee0c6 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -800,7 +800,11 @@ Ext.define('PBS.Utils', {
([m, msg], pair) => {
const [key, value] = pair.split('=');
if (key === 'message') {
- return [m, value.replace(/^"(.*)"$/, '$1').replace(/\\"/g, '"')];
+ try {
+ return [m, decodeURIComponent(value)];
+ } catch {
+ return [m, value];
+ }
} else {
return [value ?? key, msg];
}
diff --git a/www/window/MaintenanceOptions.js b/www/window/MaintenanceOptions.js
index 9a735e5e..e9740843 100644
--- a/www/window/MaintenanceOptions.js
+++ b/www/window/MaintenanceOptions.js
@@ -39,9 +39,8 @@ Ext.define('PBS.window.MaintenanceOptions', {
if (values.delete === 'maintenance-type') {
values.delete = 'maintenance-mode';
} else if (values['maintenance-type']) {
- const message = (values['maintenance-msg'] ?? '')
- .replaceAll('\\', '')
- .replaceAll('"', '\\"');
+ // property string values can't contain symbols like commas and equal signs
+ const message = encodeURIComponent(values['maintenance-msg'] ?? '');
const maybe_message = values['maintenance-msg'] ? `,message="${message}"` : '';
values['maintenance-mode'] = `type=${values['maintenance-type']}${maybe_message}`;
}
--
2.47.3
next reply other threads:[~2026-03-26 13:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 13:46 Robert Obkircher [this message]
2026-03-27 9:19 ` Dominik Csapak
2026-03-27 10:20 ` Robert Obkircher
2026-03-27 10:47 ` Dominik Csapak
2026-03-27 12:52 ` Robert Obkircher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260326134854.176430-1-r.obkircher@proxmox.com \
--to=r.obkircher@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox