public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Moayad Almalat <m.almalat@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api] Registration: Restrict special characters in usernames when creating a new user
Date: Tue, 28 Mar 2023 11:33:11 +0200	[thread overview]
Message-ID: <20230328093336.830181-1-m.almalat@proxmox.com> (raw)

From: Moayad Almalat <m.almalat@.proxmox.com>

Signed-off-by: Moayad Almalat <m.almalat@proxmox.com>
---
 src/PMG/Utils.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 = join('|', @$valid_pmg_realms);
-    if ($username =~ m!^([^\s:/]+)\@(${realm_list})$!) {
+    if ($username =~ m!^([A-Za-z0-9_\-.]+)\@(${realm_list})$!) {
 	return wantarray ? ($username, $1, $2) : $username;
     }
 
-- 
2.30.2




             reply	other threads:[~2023-03-28  9:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28  9:33 Moayad Almalat [this message]
2023-03-29 12:37 ` Fabian Grünbichler

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=20230328093336.830181-1-m.almalat@proxmox.com \
    --to=m.almalat@proxmox.com \
    --cc=pmg-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal