|
@@ -52,7 +52,7 @@ func ValidateClientCommonConfig(c *v1.ClientCommonConfig, unsafeFeatures v1.Unsa
|
|
|
|
|
|
|
|
// Validate tokenSource if specified
|
|
// Validate tokenSource if specified
|
|
|
if c.Auth.TokenSource != nil {
|
|
if c.Auth.TokenSource != nil {
|
|
|
- if c.Auth.TokenSource.Type == "exec" && !unsafeFeatures.TokenSourceExec {
|
|
|
|
|
|
|
+ if c.Auth.TokenSource.Type == "exec" && !unsafeFeatures.IsEnabled(v1.UnsafeFeatureTokenSourceExec) {
|
|
|
errs = AppendError(errs, fmt.Errorf("unsafe 'exec' not allowed for auth.tokenSource.type"))
|
|
errs = AppendError(errs, fmt.Errorf("unsafe 'exec' not allowed for auth.tokenSource.type"))
|
|
|
}
|
|
}
|
|
|
if err := c.Auth.TokenSource.Validate(); err != nil {
|
|
if err := c.Auth.TokenSource.Validate(); err != nil {
|
|
@@ -62,10 +62,12 @@ func ValidateClientCommonConfig(c *v1.ClientCommonConfig, unsafeFeatures v1.Unsa
|
|
|
|
|
|
|
|
if c.Auth.OIDC.TokenSource != nil {
|
|
if c.Auth.OIDC.TokenSource != nil {
|
|
|
// Validate oidc.tokenSource mutual exclusivity with other fields of oidc
|
|
// Validate oidc.tokenSource mutual exclusivity with other fields of oidc
|
|
|
- if c.Auth.OIDC.ClientID != "" || c.Auth.OIDC.ClientSecret != "" || c.Auth.OIDC.Audience != "" || c.Auth.OIDC.Scope != "" || c.Auth.OIDC.TokenEndpointURL != "" || len(c.Auth.OIDC.AdditionalEndpointParams) > 0 || c.Auth.OIDC.TrustedCaFile != "" || c.Auth.OIDC.InsecureSkipVerify || c.Auth.OIDC.ProxyURL != "" {
|
|
|
|
|
|
|
+ if c.Auth.OIDC.ClientID != "" || c.Auth.OIDC.ClientSecret != "" || c.Auth.OIDC.Audience != "" ||
|
|
|
|
|
+ c.Auth.OIDC.Scope != "" || c.Auth.OIDC.TokenEndpointURL != "" || len(c.Auth.OIDC.AdditionalEndpointParams) > 0 ||
|
|
|
|
|
+ c.Auth.OIDC.TrustedCaFile != "" || c.Auth.OIDC.InsecureSkipVerify || c.Auth.OIDC.ProxyURL != "" {
|
|
|
errs = AppendError(errs, fmt.Errorf("cannot specify both auth.oidc.tokenSource and any other field of auth.oidc"))
|
|
errs = AppendError(errs, fmt.Errorf("cannot specify both auth.oidc.tokenSource and any other field of auth.oidc"))
|
|
|
}
|
|
}
|
|
|
- if c.Auth.OIDC.TokenSource.Type == "exec" && !unsafeFeatures.TokenSourceExec {
|
|
|
|
|
|
|
+ if c.Auth.OIDC.TokenSource.Type == "exec" && !unsafeFeatures.IsEnabled(v1.UnsafeFeatureTokenSourceExec) {
|
|
|
errs = AppendError(errs, fmt.Errorf("unsafe 'exec' not allowed for auth.oidc.tokenSource.type"))
|
|
errs = AppendError(errs, fmt.Errorf("unsafe 'exec' not allowed for auth.oidc.tokenSource.type"))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -114,7 +116,12 @@ func ValidateClientCommonConfig(c *v1.ClientCommonConfig, unsafeFeatures v1.Unsa
|
|
|
return warnings, errs
|
|
return warnings, errs
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func ValidateAllClientConfig(c *v1.ClientCommonConfig, proxyCfgs []v1.ProxyConfigurer, visitorCfgs []v1.VisitorConfigurer, unsafeFeatures v1.UnsafeFeatures) (Warning, error) {
|
|
|
|
|
|
|
+func ValidateAllClientConfig(
|
|
|
|
|
+ c *v1.ClientCommonConfig,
|
|
|
|
|
+ proxyCfgs []v1.ProxyConfigurer,
|
|
|
|
|
+ visitorCfgs []v1.VisitorConfigurer,
|
|
|
|
|
+ unsafeFeatures v1.UnsafeFeatures,
|
|
|
|
|
+) (Warning, error) {
|
|
|
var warnings Warning
|
|
var warnings Warning
|
|
|
if c != nil {
|
|
if c != nil {
|
|
|
warning, err := ValidateClientCommonConfig(c, unsafeFeatures)
|
|
warning, err := ValidateClientCommonConfig(c, unsafeFeatures)
|