mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-02-10 03:55:36 +08:00
WAF允许动作默认跳过所有规则
This commit is contained in:
@@ -5,8 +5,18 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type AllowScope = string
|
||||
|
||||
const (
|
||||
AllowScopeGroup AllowScope = "group"
|
||||
AllowScopeServer AllowScope = "server"
|
||||
AllowScopeGlobal AllowScope = "global"
|
||||
)
|
||||
|
||||
type AllowAction struct {
|
||||
BaseAction
|
||||
|
||||
Scope AllowScope `yaml:"scope" json:"scope"`
|
||||
}
|
||||
|
||||
func (this *AllowAction) Init(waf *WAF) error {
|
||||
@@ -25,7 +35,12 @@ func (this *AllowAction) WillChange() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *AllowAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, request requests.Request, writer http.ResponseWriter) (continueRequest bool, goNextSet bool) {
|
||||
func (this *AllowAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, request requests.Request, writer http.ResponseWriter) PerformResult {
|
||||
// do nothing
|
||||
return true, false
|
||||
return PerformResult{
|
||||
ContinueRequest: true,
|
||||
GoNextGroup: this.Scope == AllowScopeGroup,
|
||||
IsAllowed: true,
|
||||
AllowScope: this.Scope,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user