From c0f015ad70e7fa78bb892345a18227fa968d4d0b Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 12 Sep 2025 16:17:17 +0100 Subject: [PATCH] change rewriteTargetWithoutCaptureGroup lint to include any numbered capture group --- cmd/plugin/lints/ingress.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/plugin/lints/ingress.go b/cmd/plugin/lints/ingress.go index d5ad42e2cd..b844deb05e 100644 --- a/cmd/plugin/lints/ingress.go +++ b/cmd/plugin/lints/ingress.go @@ -18,6 +18,7 @@ package lints import ( "fmt" + "regexp" "strings" networking "k8s.io/api/networking/v1" @@ -126,7 +127,7 @@ func annotationPrefixIsNginxOrg(ing *networking.Ingress) bool { func rewriteTargetWithoutCaptureGroup(ing *networking.Ingress) bool { for name, val := range ing.Annotations { - if strings.HasSuffix(name, "/rewrite-target") && !strings.Contains(val, "$1") { + if strings.HasSuffix(name, "/rewrite-target") && !regexp.MustCompile(`\$\d+`).MatchString(val) { return true } }