diff --git a/cmd/nerdctl/login.go b/cmd/nerdctl/login.go index 07e03253f50..8648efdedff 100644 --- a/cmd/nerdctl/login.go +++ b/cmd/nerdctl/login.go @@ -19,6 +19,7 @@ package main import ( "errors" "io" + "net/url" "strings" "github.com/containerd/log" @@ -82,6 +83,11 @@ func processLoginOptions(cmd *cobra.Command) (types.LoginCommandOptions, error) password = strings.TrimSuffix(string(contents), "\n") password = strings.TrimSuffix(password, "\r") } + + if strings.Contains(username, ":") { + return types.LoginCommandOptions{}, errors.New("username cannot contain colons") + } + return types.LoginCommandOptions{ GOptions: globalOptions, Username: username,