From 95a7dde2aef13bba612e7184ecb246c89ee16599 Mon Sep 17 00:00:00 2001 From: cvignal Date: Sat, 12 Oct 2024 11:35:31 +0200 Subject: [PATCH] add `=` character to tag validation regex (#2008) --- pkg/tags/tags.go | 2 +- pkg/tags/tags_test.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/tags/tags.go b/pkg/tags/tags.go index 7a84a6f34..33465c632 100644 --- a/pkg/tags/tags.go +++ b/pkg/tags/tags.go @@ -69,7 +69,7 @@ const ( // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-restrictions // borrowed from this article and also testing various ASCII characters following regex // is supported by AWS S3 for both tags and values. -var validTagKeyValue = regexp.MustCompile(`^[a-zA-Z0-9-+\-._:/@ ]+$`) +var validTagKeyValue = regexp.MustCompile(`^[a-zA-Z0-9-+\-._:/@ =]+$`) func checkKey(key string) error { if len(key) == 0 { diff --git a/pkg/tags/tags_test.go b/pkg/tags/tags_test.go index 129a10986..d402ccb4a 100644 --- a/pkg/tags/tags_test.go +++ b/pkg/tags/tags_test.go @@ -43,6 +43,11 @@ func TestParseTags(t *testing.T) { false, 2, }, + { + "key=value=", + false, + 1, + }, { fmt.Sprintf("%0128d=%0256d", 1, 1), false,