From 494112adbe2c217e0970ba52437816e63a386f7d Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Fri, 27 Nov 2020 18:00:34 +0800 Subject: [PATCH] =?UTF-8?q?[WAF]=E4=BF=AE=E5=A4=8D=E2=80=9C=E5=8C=85?= =?UTF-8?q?=E5=90=AB=E5=AD=97=E7=AC=A6=E4=B8=B2=E2=80=9D=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E7=AC=A6=E5=AF=B9=E5=AD=97=E8=8A=82=E6=95=B0=E7=BB=84=E7=9A=84?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/waf/rule.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/internal/waf/rule.go b/internal/waf/rule.go index 9633dbe..7af5fda 100644 --- a/internal/waf/rule.go +++ b/internal/waf/rule.go @@ -384,13 +384,16 @@ func (this *Rule) Test(value interface{}) bool { return !utils.MatchStringCache(this.reg, types.String(value)) case RuleOperatorContains: if types.IsSlice(value) { - ok := false - lists.Each(value, func(k int, v interface{}) { - if types.String(v) == this.Value { - ok = true - } - }) - return ok + _, isBytes := value.([]byte) + if !isBytes { + ok := false + lists.Each(value, func(k int, v interface{}) { + if types.String(v) == this.Value { + ok = true + } + }) + return ok + } } if types.IsMap(value) { lowerValue := ""