From e3f5a77ade52d257148a0d11d90996db077a8127 Mon Sep 17 00:00:00 2001 From: "R.B. Boyer" Date: Mon, 25 Jan 2021 11:27:38 -0600 Subject: [PATCH] server: add OSS stubs supporting validation of source namespaces in service-intentions config entries (#9527) --- .changelog/9527.txt | 3 +++ agent/structs/config_entry_intentions.go | 4 ++++ agent/structs/config_entry_intentions_oss.go | 7 +++++++ 3 files changed, 14 insertions(+) create mode 100644 .changelog/9527.txt create mode 100644 agent/structs/config_entry_intentions_oss.go diff --git a/.changelog/9527.txt b/.changelog/9527.txt new file mode 100644 index 000000000..2548f882e --- /dev/null +++ b/.changelog/9527.txt @@ -0,0 +1,3 @@ +```release-note:improvement +server: **(Enterprise Only)** Validate source namespaces in service-intentions config entries. +``` diff --git a/agent/structs/config_entry_intentions.go b/agent/structs/config_entry_intentions.go index 21e55224c..5cd103614 100644 --- a/agent/structs/config_entry_intentions.go +++ b/agent/structs/config_entry_intentions.go @@ -567,6 +567,10 @@ func (e *ServiceIntentionsConfigEntry) validate(legacyWrite bool) error { return fmt.Errorf("Sources[%d].%v", i, err) } + if err := validateSourceIntentionEnterpriseMeta(&src.EnterpriseMeta); err != nil { + return fmt.Errorf("Sources[%d].%v", i, err) + } + // Length of opaque values if len(src.Description) > metaValueMaxLength { return fmt.Errorf( diff --git a/agent/structs/config_entry_intentions_oss.go b/agent/structs/config_entry_intentions_oss.go new file mode 100644 index 000000000..cec1be512 --- /dev/null +++ b/agent/structs/config_entry_intentions_oss.go @@ -0,0 +1,7 @@ +// +build !consulent + +package structs + +func validateSourceIntentionEnterpriseMeta(_ *EnterpriseMeta) error { + return nil +}