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

This commit is contained in:
刘祥超
2020-11-27 18:00:34 +08:00
parent cc425f490d
commit 2e4f19978a

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