From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 2BE7E9262F for ; Wed, 29 Mar 2023 14:37:37 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1159A3B4EB for ; Wed, 29 Mar 2023 14:37:37 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 29 Mar 2023 14:37:35 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 44953472DD for ; Wed, 29 Mar 2023 14:37:35 +0200 (CEST) Date: Wed, 29 Mar 2023 14:37:28 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Moayad Almalat , pmg-devel@lists.proxmox.com References: <20230328093336.830181-1-m.almalat@proxmox.com> In-Reply-To: <20230328093336.830181-1-m.almalat@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1680093123.ip2f1r6odb.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.072 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 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 pmg-api] Registration: Restrict special characters in usernames when creating a new user 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: , X-List-Received-Date: Wed, 29 Mar 2023 12:37:37 -0000 On March 28, 2023 11:33 am, Moayad Almalat wrote: > From: Moayad Almalat >=20 > Signed-off-by: Moayad Almalat > --- > src/PMG/Utils.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm > index 6405934..41b47c7 100644 > --- a/src/PMG/Utils.pm > +++ b/src/PMG/Utils.pm > @@ -92,7 +92,7 @@ sub verify_username { > # slash is not allowed because it is used as pve API delimiter > # also see "man useradd" > my $realm_list =3D join('|', @$valid_pmg_realms); > - if ($username =3D~ m!^([^\s:/]+)\@(${realm_list})$!) { > + if ($username =3D~ m!^([A-Za-z0-9_\-.]+)\@(${realm_list})$!) { > return wantarray ? ($username, $1, $2) : $username; > } this doesn't only restrict the allowed characters when registering, but als= o for all existing users, including logging in.. probably adding \0 to the list of forbidden characters is sane, anything el= se requires careful checks and maybe fixing in other places rather than here (= or at least, be post-poned to a major release so that people can fix up their con= fig beforehand). see the PVE bug for a similar issue: https://bugzilla.proxmox.com/show_bug.= cgi?id=3D4461