Prevent partition-exports entry from OSS usage

Validation was added on the config entry kind since that is called when
validating config entries to bootstrap via agent configuration and when
applying entries via the config RPC endpoint.
This commit is contained in:
freddygv 2021-11-29 11:21:33 -07:00
parent 48954adfdc
commit 6d51282adf
2 changed files with 11 additions and 3 deletions

View File

@ -113,7 +113,12 @@ func (e *PartitionExportsConfigEntry) Validate() error {
return fmt.Errorf("partition-exports Name must be the name of a partition, and not a wildcard")
}
validationErr := validateConfigEntryMeta(e.Meta)
if err := requireEnterprise(e.GetKind()); err != nil {
return err
}
if err := validateConfigEntryMeta(e.Meta); err != nil {
return err
}
for _, svc := range e.Services {
if svc.Name == "" {
@ -128,8 +133,7 @@ func (e *PartitionExportsConfigEntry) Validate() error {
}
}
}
return validationErr
return nil
}
func (e *PartitionExportsConfigEntry) CanRead(authz acl.Authorizer) bool {

View File

@ -35,3 +35,7 @@ func validateUnusedKeys(unused []string) error {
func validateInnerEnterpriseMeta(_, _ *EnterpriseMeta) error {
return nil
}
func requireEnterprise(kind string) error {
return fmt.Errorf("Config entry kind %q requires Consul Enterprise", kind)
}