From 13719ac7c524838828888a032fa4da0cba32a7b0 Mon Sep 17 00:00:00 2001 From: k8s-infra-cherrypick-robot <90416843+k8s-infra-cherrypick-robot@users.noreply.github.com> Date: Mon, 26 Aug 2024 17:08:53 -0700 Subject: [PATCH] Annotations: Allow commas in URLs. (#11887) Signed-off-by: James Strong Co-authored-by: James Strong --- internal/ingress/annotations/parser/validators.go | 2 +- internal/ingress/annotations/parser/validators_test.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/ingress/annotations/parser/validators.go b/internal/ingress/annotations/parser/validators.go index ffb4d9ba9f..31524508f5 100644 --- a/internal/ingress/annotations/parser/validators.go +++ b/internal/ingress/annotations/parser/validators.go @@ -44,7 +44,7 @@ var ( alphaNumericChars = `\-\.\_\~a-zA-Z0-9\/:` extendedAlphaNumeric = alphaNumericChars + ", " regexEnabledChars = regexp.QuoteMeta(`^$[](){}*+?|&=\`) - urlEnabledChars = regexp.QuoteMeta(`:?&=`) + urlEnabledChars = regexp.QuoteMeta(`,:?&=`) ) // IsValidRegex checks if the tested string can be used as a regex, but without any weird character. diff --git a/internal/ingress/annotations/parser/validators_test.go b/internal/ingress/annotations/parser/validators_test.go index ed84494528..6c88342e43 100644 --- a/internal/ingress/annotations/parser/validators_test.go +++ b/internal/ingress/annotations/parser/validators_test.go @@ -55,6 +55,11 @@ func TestValidateArrayOfServerName(t *testing.T) { value: "*.so*mething.com,bla.com", wantErr: false, }, + { + name: "should allow comma separated query params", + value: "https://oauth.example/oauth2/auth?allowed_groups=gid1,gid2", + wantErr: false, + }, { name: "should deny names with weird characters", value: "something.com,lolo;xpto.com,nothing.com",