WAF标签动作匹配之后可以继续尝试匹配别的分组中的规则集

This commit is contained in:
GoEdgeLab
2022-08-25 16:44:44 +08:00
parent 61ecec414f
commit 9c3fdbed59
17 changed files with 74 additions and 70 deletions

View File

@@ -1,8 +1,8 @@
package waf
import (
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
"github.com/iwind/TeaGo/logs"
"github.com/iwind/TeaGo/types"
"net/http"
)
@@ -30,23 +30,23 @@ func (this *GoSetAction) WillChange() bool {
return true
}
func (this *GoSetAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, request requests.Request, writer http.ResponseWriter) (allow bool) {
func (this *GoSetAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, request requests.Request, writer http.ResponseWriter) (continueRequest bool, goNextSet bool) {
nextGroup := waf.FindRuleGroup(types.Int64(this.GroupId))
if nextGroup == nil || !nextGroup.IsOn {
return true
return true, true
}
nextSet := nextGroup.FindRuleSet(types.Int64(this.SetId))
if nextSet == nil || !nextSet.IsOn {
return true
return true, true
}
b, _, err := nextSet.MatchRequest(request)
if err != nil {
logs.Error(err)
return true
remotelogs.Error("WAF", "GO_GROUP_ACTION: "+err.Error())
return true, false
}
if !b {
return true
return true, false
}
return nextSet.PerformActions(waf, nextGroup, request, writer)
}