mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-02-04 23:35:47 +08:00
修复WAF策略模式为空导致动作不起作用的问题
This commit is contained in:
@@ -57,6 +57,9 @@ func (this *WAFManager) convertWAF(policy *firewallconfigs.HTTPFirewallPolicy) (
|
||||
if policy == nil {
|
||||
return nil, errors.New("policy should not be nil")
|
||||
}
|
||||
if len(policy.Mode) == 0 {
|
||||
policy.Mode = firewallconfigs.FirewallModeDefend
|
||||
}
|
||||
w := &waf.WAF{
|
||||
Id: strconv.FormatInt(policy.Id, 10),
|
||||
IsOn: policy.IsOn,
|
||||
|
||||
@@ -118,7 +118,7 @@ func (this *RuleSet) ActionCodes() []string {
|
||||
}
|
||||
|
||||
func (this *RuleSet) PerformActions(waf *WAF, group *RuleGroup, req requests.Request, writer http.ResponseWriter) bool {
|
||||
if waf.Mode != firewallconfigs.FirewallModeDefend {
|
||||
if len(waf.Mode) != 0 && waf.Mode != firewallconfigs.FirewallModeDefend {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user