diff --git a/pkg/agent/plugin/svidstore/utils.go b/pkg/agent/plugin/svidstore/utils.go index f0138ab829..80595b3ca3 100644 --- a/pkg/agent/plugin/svidstore/utils.go +++ b/pkg/agent/plugin/svidstore/utils.go @@ -64,7 +64,7 @@ func SecretFromProto(req *svidstorev1.PutX509SVIDRequest) (*Data, error) { func ParseMetadata(metaData []string) (map[string]string, error) { data := make(map[string]string) for _, s := range metaData { - value := strings.Split(s, ":") + value := strings.SplitN(s, ":", 2) if len(value) < 2 { return nil, fmt.Errorf("metadata does not contain a colon: %q", s) } diff --git a/pkg/agent/plugin/svidstore/utils_test.go b/pkg/agent/plugin/svidstore/utils_test.go index 8d38d2b972..ff9325b6df 100644 --- a/pkg/agent/plugin/svidstore/utils_test.go +++ b/pkg/agent/plugin/svidstore/utils_test.go @@ -81,6 +81,17 @@ func TestParseMetadata(t *testing.T) { "c": "3", }, }, + { + name: "multiples selectors", + secretData: []string{ + "a:b:c", + "d:e-f:g-h", + }, + expect: map[string]string{ + "a": "b:c", + "d": "e-f:g-h", + }, + }, { name: "no data", secretData: []string{},