From c1f854733d7fc87e1be4f7023eb8bc07fd388328 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 12 Apr 2024 20:51:07 +0200 Subject: [PATCH] fix: @ char is valid for AWS ARNs (#1258) --- cmd/infractl/cluster/utils/validate.go | 2 +- cmd/infractl/cluster/utils/validate_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/infractl/cluster/utils/validate.go b/cmd/infractl/cluster/utils/validate.go index 1f4f110d8..7709bafed 100644 --- a/cmd/infractl/cluster/utils/validate.go +++ b/cmd/infractl/cluster/utils/validate.go @@ -67,7 +67,7 @@ func ValidateParameterArgument(parts []string) error { if value == "" { return errors.New("value is empty") } - match, err = regexp.MatchString(`^[a-zA-Z0-9:\/\?._-]+$`, value) + match, err = regexp.MatchString(`^[a-zA-Z0-9:\/\?._@-]+$`, value) if err != nil { return err } diff --git a/cmd/infractl/cluster/utils/validate_test.go b/cmd/infractl/cluster/utils/validate_test.go index c165f3e74..b5e097633 100644 --- a/cmd/infractl/cluster/utils/validate_test.go +++ b/cmd/infractl/cluster/utils/validate_test.go @@ -12,4 +12,7 @@ func TestValidateParameterArgument(t *testing.T) { err = ValidateParameterArgument([]string{"container-type", "container_d"}) assert.NoError(t, err, "no error expected") + + err = ValidateParameterArgument([]string{"user-arns", "arn:aws:iam::393282794030:user/joey@stackrox.com"}) + assert.NoError(t, err, "no error expected") }