From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 1F23D1FF0AA for ; Tue, 06 Oct 2026 11:54:26 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id A98CA213BC; Tue, 06 Oct 2026 11:54:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dualfroz.com; s=dkim; t=1791280458; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding; bh=OzAqhDMEotmwDkKyDPU1euBMuR2cJ9iX4ET06z+AcDs=; b=y5zR2bSTwYQSPhWjWeIOjFabvjQAObe5d3O6/y+GzfVnipFKJ+kw1Nntmj4xGkCNHRXSxs 4cHxzHR1b19Q9j5aG9mU5Lbko81CI6OFKkynjNFyx8ibbCX55sK04Bu/fWOGVZQitTJOAy 8KhXP/rXUr/kVTeQlUeDyH9FjYmcQE5Z9EHAFTXvFztIM+cOC5Sij8TB9ZMdXtYQuZlwKD PisPpRUd4g6bERAhXV57gKJUCLeohkjvV6UqjBEDMDjzmj6TdwPjtYqwypYl9AmebiwJJ0 NKVojHZnPJEHwcqc6XnlBIYVgtZ+VXp2TtFYJkxF2Dvae3QP4YJGvbWcep1+1g== From: Michal Fox To: pve-devel@lists.proxmox.com Subject: [PATCH widget-toolkit] fix #7586: notification: check names of matchers and targets in the UI Date: Tue, 6 Oct 2026 09:54:16 +0000 Message-ID: <20261006095416.7-1-me@dualfroz.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.140 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: OEDSXU4QY5DCJB435JVV5GWE2FSGISLN X-Message-ID-Hash: OEDSXU4QY5DCJB435JVV5GWE2FSGISLN X-MailFrom: me@dualfroz.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The names of notification matchers and targets have to be safe IDs, but only the name of webhook targets was checked in the UI, and that without saying what is wrong. For all others, an invalid name, for example one containing a space, was only rejected by the API with a 'parameter verification errors (400)' message, without saying which characters are allowed. Add a 'SafeId' vtype, which uses the existing safe ID regex and says which characters are allowed, and use it for the names of matchers and all target types. Signed-off-by: Michal Fox --- Tested in the browser with the matcher and all target edit windows: names with a space or a slash now show which characters are allowed, valid names are still accepted. Proxmox VE uses the stricter 'pve-configid' format for these names in its API, so there, names starting with a digit or containing a dot are still only rejected by the API. src/Toolkit.js | 9 +++++++++ src/panel/GotifyEditPanel.js | 1 + src/panel/SendmailEditPanel.js | 1 + src/panel/SmtpEditPanel.js | 1 + src/panel/WebhookEditPanel.js | 2 +- src/window/NotificationMatcherEdit.js | 1 + 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Toolkit.js b/src/Toolkit.js index bd31b3c..c1594b7 100644 --- a/src/Toolkit.js +++ b/src/Toolkit.js @@ -134,6 +134,15 @@ Ext.apply(Ext.form.field.VTypes, { ': ' + gettext('letter'), + SafeId: function (v) { + return Proxmox.Utils.safeIdRegex.test(v); + }, + SafeIdText: + gettext('Allowed characters') + + ": 'A-Z', 'a-z', '0-9', '_', '-', '.'
" + + gettext('Must start with') + + ": 'A-Z', 'a-z', '0-9', '_'", + HttpProxy: function (v) { return /^http:\/\/.*$/.test(v); }, diff --git a/src/panel/GotifyEditPanel.js b/src/panel/GotifyEditPanel.js index 5e78e73..3e12323 100644 --- a/src/panel/GotifyEditPanel.js +++ b/src/panel/GotifyEditPanel.js @@ -15,6 +15,7 @@ Ext.define('Proxmox.panel.GotifyEditPanel', { editable: '{isCreate}', }, fieldLabel: gettext('Endpoint Name'), + vtype: 'SafeId', allowBlank: false, }, { diff --git a/src/panel/SendmailEditPanel.js b/src/panel/SendmailEditPanel.js index a4de50c..81624ad 100644 --- a/src/panel/SendmailEditPanel.js +++ b/src/panel/SendmailEditPanel.js @@ -26,6 +26,7 @@ Ext.define('Proxmox.panel.SendmailEditPanel', { editable: '{isCreate}', }, fieldLabel: gettext('Endpoint Name'), + vtype: 'SafeId', allowBlank: false, }, { diff --git a/src/panel/SmtpEditPanel.js b/src/panel/SmtpEditPanel.js index 37e4d51..8fafba9 100644 --- a/src/panel/SmtpEditPanel.js +++ b/src/panel/SmtpEditPanel.js @@ -51,6 +51,7 @@ Ext.define('Proxmox.panel.SmtpEditPanel', { editable: '{isCreate}', }, fieldLabel: gettext('Endpoint Name'), + vtype: 'SafeId', allowBlank: false, }, { diff --git a/src/panel/WebhookEditPanel.js b/src/panel/WebhookEditPanel.js index 7980d8b..8854329 100644 --- a/src/panel/WebhookEditPanel.js +++ b/src/panel/WebhookEditPanel.js @@ -17,7 +17,7 @@ Ext.define('Proxmox.panel.WebhookEditPanel', { editable: '{isCreate}', }, fieldLabel: gettext('Endpoint Name'), - regex: Proxmox.Utils.safeIdRegex, + vtype: 'SafeId', allowBlank: false, }, ], diff --git a/src/window/NotificationMatcherEdit.js b/src/window/NotificationMatcherEdit.js index a1d173c..d1b66a3 100644 --- a/src/window/NotificationMatcherEdit.js +++ b/src/window/NotificationMatcherEdit.js @@ -12,6 +12,7 @@ Ext.define('Proxmox.panel.NotificationMatcherGeneralPanel', { editable: '{isCreate}', }, fieldLabel: gettext('Matcher Name'), + vtype: 'SafeId', allowBlank: false, }, { -- 2.43.0