Skip to content

Commit

Permalink
Check the provided URL during login (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasmik authored Jul 28, 2023
1 parent 35f7028 commit d3eec79
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/cmd/profile/login_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@ func loginAction(ctx *cli.Context) error {
return errors.New("Spacelift endpoint cannot be empty")
}

_, err = url.ParseRequestURI(endpoint)
url, err := url.ParseRequestURI(endpoint)
if err != nil {
return fmt.Errorf("invalid Spacelift endpoint: %w", err)
}
if url.Scheme == "" || url.Host == "" {
return fmt.Errorf("scheme and host must be valid: parsed scheme %q and host %q", url.Scheme, url.Host)
}

storedCredentials.Endpoint = endpoint

Loop:
Expand Down

0 comments on commit d3eec79

Please sign in to comment.