structs: prevent service-defaults upstream configs from using wildcard names or namespaces (#10475)

This commit is contained in:
R.B. Boyer 2021-06-23 15:48:54 -05:00 committed by GitHub
parent 8db2865e86
commit 8344b7fe2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

3
.changelog/10475.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
structs: prevent service-defaults upstream configs from using wildcard names or namespaces
```

View File

@ -789,6 +789,12 @@ func (cfg UpstreamConfig) validate(named bool) error {
if cfg.Name == "" {
return fmt.Errorf("Name is required")
}
if cfg.Name == WildcardSpecifier {
return fmt.Errorf("Wildcard name is not supported")
}
if cfg.EnterpriseMeta.NamespaceOrDefault() == WildcardSpecifier {
return fmt.Errorf("Wildcard namespace is not supported")
}
} else {
if cfg.Name != "" {
return fmt.Errorf("Name must be empty")