Files
EdgeNode/internal/waf/action_allow.go

48 lines
903 B
Go
Raw Permalink Normal View History

2020-10-08 15:06:42 +08:00
package waf
import (
"net/http"
2024-07-27 15:42:50 +08:00
"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
2020-10-08 15:06:42 +08:00
)
type AllowScope = string
const (
AllowScopeGroup AllowScope = "group"
AllowScopeServer AllowScope = "server"
AllowScopeGlobal AllowScope = "global"
)
2020-10-08 15:06:42 +08:00
type AllowAction struct {
BaseAction
Scope AllowScope `yaml:"scope" json:"scope"`
2020-10-08 15:06:42 +08:00
}
2021-07-18 15:51:49 +08:00
func (this *AllowAction) Init(waf *WAF) error {
return nil
}
func (this *AllowAction) Code() string {
return ActionAllow
}
func (this *AllowAction) IsAttack() bool {
return false
}
func (this *AllowAction) WillChange() bool {
return true
2021-07-18 15:51:49 +08:00
}
func (this *AllowAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, request requests.Request, writer http.ResponseWriter) PerformResult {
2020-10-08 15:06:42 +08:00
// do nothing
return PerformResult{
ContinueRequest: true,
GoNextGroup: this.Scope == AllowScopeGroup,
IsAllowed: true,
AllowScope: this.Scope,
}
2020-10-08 15:06:42 +08:00
}