From f63081507b4952d898cf4558ee55645f733e7a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cz=C3=A9kus=20M=C3=A1t=C3=A9?= Date: Wed, 3 Jul 2024 18:27:36 +0200 Subject: [PATCH] fix: add login component username validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Czékus Máté --- cmd/nerdctl/login.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/nerdctl/login.go b/cmd/nerdctl/login.go index 07e03253f50..9aea0501f88 100644 --- a/cmd/nerdctl/login.go +++ b/cmd/nerdctl/login.go @@ -62,6 +62,10 @@ func processLoginOptions(cmd *cobra.Command) (types.LoginCommandOptions, error) return types.LoginCommandOptions{}, err } + if strings.Contains(username, ":") { + return types.LoginCommandOptions{}, errors.New("username cannot contain colons") + } + if password != "" { log.L.Warn("WARNING! Using --password via the CLI is insecure. Use --password-stdin.") if passwordStdin {