Skip to content

Commit

Permalink
fix: add login component username validation
Browse files Browse the repository at this point in the history
Signed-off-by: Czékus Máté <[email protected]>
  • Loading branch information
Shikachuu committed Jul 6, 2024
1 parent 95a5fca commit d739054
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/nerdctl/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,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,
Expand Down

0 comments on commit d739054

Please sign in to comment.