From baa08d8d18f4a92838d3705d763b14ca91423eff Mon Sep 17 00:00:00 2001 From: Max Sokolovsky Date: Tue, 8 Mar 2022 12:53:07 -0500 Subject: [PATCH] Escape quotes in username, password, responseType for an auth request --- cmd/kubectl_token.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/kubectl_token.go b/cmd/kubectl_token.go index 3b3be7b6..e9b4f241 100644 --- a/cmd/kubectl_token.go +++ b/cmd/kubectl_token.go @@ -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)))