[WAF]修复“包含字符串”操作符对字节数组的匹配错误

This commit is contained in:
GoEdgeLab
2020-11-27 18:00:34 +08:00
parent 74c350b488
commit 494112adbe

View File

@@ -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 := ""