Skip to content

Commit

Permalink
Merge pull request #312 from maxsokolovsky/escape-quotes-in-username-…
Browse files Browse the repository at this point in the history
…password

Escape quotes in username, password, responseType before sending auth request
  • Loading branch information
maxsokolovsky authored Apr 19, 2022
2 parents 27cb4fd + baa08d8 commit 2444900
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/kubectl_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func basicAuth(input *LoginInput, tlsConfig *tls.Config) (managementClient.Token
responseType = fmt.Sprintf("%s_%s", responseType, input.clusterID)
}

body := fmt.Sprintf(`{"responseType":"%s", "username":"%s", "password":"%s"}`, responseType, username, password)
body := fmt.Sprintf(`{"responseType":%q, "username":%q, "password":%q}`, responseType, username, password)

url := fmt.Sprintf("%s/v3-public/%ss/%s?action=login", input.server, input.authProvider,
strings.ToLower(strings.Replace(input.authProvider, "Provider", "", 1)))
Expand Down

0 comments on commit 2444900

Please sign in to comment.