From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 2B8E91FF170 for ; Thu, 26 Jun 2025 12:46:47 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DA04D36E6B; Thu, 26 Jun 2025 12:47:22 +0200 (CEST) Date: Thu, 26 Jun 2025 12:47:16 +0200 From: Stoiko Ivanov To: Christoph Heiss Message-ID: <20250626124716.3a3a9d7b@rosa.proxmox.com> In-Reply-To: <20250318135919.888083-3-c.heiss@proxmox.com> References: <20250318135919.888083-1-c.heiss@proxmox.com> <20250318135919.888083-3-c.heiss@proxmox.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.237 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy ENA_SUBJ_ODD_CASE 2.6 Subject has odd case KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pmg-devel] [PATCH widget-toolkit 2/2] window: AuthEditOpenId: add validation for required fields X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pmg-devel@lists.proxmox.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" On Tue, 18 Mar 2025 14:59:18 +0100 Christoph Heiss wrote: > For the `client-id` and `client-secret` OIDC-specific fields, allow the > format specified in RFC 6749, Appendix A [0]. > > As per that, the OIDC-specific `client-id` and `client-key` can contain > any printable ascii character, i.e. anything in the (inclusive) range > 0x20-0x7E. > > For the issuer URL, use our existing URL validation regex, while the > realm name itself must follow authentication realm naming scheme. > > [0] https://www.rfc-editor.org/rfc/rfc6749#appendix-A > > Signed-off-by: Christoph Heiss not a maintainer for widget-toolkit - but from looking through the RFC consider this: Reviewed-by: Stoiko Ivanov > --- > src/Utils.js | 4 ++++ > src/window/AuthEditOpenId.js | 8 ++++++++ > 2 files changed, 12 insertions(+) > > diff --git a/src/Utils.js b/src/Utils.js > index c873c85..e17bee8 100644 > --- a/src/Utils.js > +++ b/src/Utils.js > @@ -1545,6 +1545,10 @@ utilities: { > > // Same as SAFE_ID_REGEX in proxmox-schema > me.safeIdRegex = /^(?:[A-Za-z0-9_][A-Za-z0-9._\\-]*)$/; > + > + me.printableAsciiRegex = /^[\x20-\x7E]+$/; > + > + me.authRealmNameRegex = /^[A-Za-z][A-Za-z0-9.\-_]+$/; > }, > }); > > diff --git a/src/window/AuthEditOpenId.js b/src/window/AuthEditOpenId.js > index ed0a6dc..5939516 100644 > --- a/src/window/AuthEditOpenId.js > +++ b/src/window/AuthEditOpenId.js > @@ -23,6 +23,8 @@ Ext.define('Proxmox.panel.OpenIDInputPanel', { > name: 'issuer-url', > fieldLabel: gettext('Issuer URL'), > allowBlank: false, > + regex: Proxmox.Utils.httpUrlRegex, > + regexText: gettext('Must be a valid URL'), > }, > ], > > @@ -36,6 +38,8 @@ Ext.define('Proxmox.panel.OpenIDInputPanel', { > }, > fieldLabel: gettext('Realm'), > allowBlank: false, > + regex: Proxmox.Utils.authRealmNameRegex, > + regexText: gettext('Must be a valid realm name'), > }, > { > xtype: 'proxmoxcheckbox', > @@ -57,6 +61,8 @@ Ext.define('Proxmox.panel.OpenIDInputPanel', { > fieldLabel: gettext('Client ID'), > name: 'client-id', > allowBlank: false, > + regex: Proxmox.Utils.printableAsciiRegex, // RFC 6749, Appendix A > + regexText: gettext('Must be a valid OIDC Client ID'), > }, > { > xtype: 'proxmoxtextfield', > @@ -65,6 +71,8 @@ Ext.define('Proxmox.panel.OpenIDInputPanel', { > deleteEmpty: '{!isCreate}', > }, > name: 'client-key', > + regex: Proxmox.Utils.printableAsciiRegex, // RFC 6749, Appendix A > + regexText: gettext('Must be a valid OIDC Client Secret'), > }, > ], > _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel