From 1377310110548af0639ddc1096949fb95d4ed8e4 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 19 Oct 2024 12:10:46 +0200 Subject: [PATCH] cli/command: PromptUserForCredentials: always trim password we don't support empty passwords; when prompting the user for a password, we already trim the result, but we didn't do the same for a password that's passed through stdin or through the `-p` / `--password` flag. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit a21a5f42433267052441cdb7ebe7604dfcc7f159) Signed-off-by: Sebastiaan van Stijn --- cli/command/registry.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/command/registry.go b/cli/command/registry.go index 39e2e0ddb1..177c03cbb5 100644 --- a/cli/command/registry.go +++ b/cli/command/registry.go @@ -157,6 +157,7 @@ func PromptUserForCredentials(ctx context.Context, cli Cli, argUser, argPassword } } + argPassword = strings.TrimSpace(argPassword) if argPassword == "" { restoreInput, err := DisableInputEcho(cli.In()) if err != nil {