Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

remove exec and auth provider check to utilize kubeconfig with oidc enabled #221

Merged
merged 2 commits into from
Jul 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pkg/cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func NewConfigFromBytes(kubeconfig string) *restclient.Config {
// ValidateClientConfig validates that the auth info of a given kubeconfig doesn't have unsupported fields.
func ValidateClientConfig(config clientcmdapi.Config) error {
validFields := []string{"client-certificate-data", "client-key-data", "token", "username", "password"}

pathOfKubeconfig := getKubeConfigOfCurrentTarget()
for user, authInfo := range config.AuthInfos {
switch {
case authInfo.ClientCertificate != "":
Expand All @@ -176,9 +176,13 @@ func ValidateClientConfig(config clientcmdapi.Config) error {
case authInfo.Impersonate != "" || len(authInfo.ImpersonateGroups) > 0:
return fmt.Errorf("impersonation is not supported, these are the valid fields: %+v", validFields)
case authInfo.AuthProvider != nil && len(authInfo.AuthProvider.Config) > 0:
return fmt.Errorf("auth provider configurations are not supported (user %q), these are the valid fields: %+v", user, validFields)
fmt.Printf("Kubeconfig under path %s contains auth provider configurations that could contain malicious code. Please only continue if you have verified it to be uncritical\n", pathOfKubeconfig)
return nil
// return fmt.Errorf("auth provider configurations are not supported (user %q), these are the valid fields: %+v", user, validFields)
case authInfo.Exec != nil:
return fmt.Errorf("exec configurations are not supported (user %q), these are the valid fields: %+v", user, validFields)
fmt.Printf("Kubeconfig under path %s contains exec configurations that could contain malicious code. Please only continue if you have verified it to be uncritical\n", pathOfKubeconfig)
return nil
// return fmt.Errorf("exec configurations are not supported (user %q), these are the valid fields: %+v", user, validFields)
}
}

Expand Down