[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)) return !utils.MatchStringCache(this.reg, types.String(value))
case RuleOperatorContains: case RuleOperatorContains:
if types.IsSlice(value) { if types.IsSlice(value) {
ok := false _, isBytes := value.([]byte)
lists.Each(value, func(k int, v interface{}) { if !isBytes {
if types.String(v) == this.Value { ok := false
ok = true lists.Each(value, func(k int, v interface{}) {
} if types.String(v) == this.Value {
}) ok = true
return ok }
})
return ok
}
} }
if types.IsMap(value) { if types.IsMap(value) {
lowerValue := "" lowerValue := ""