From 7618338f381827659592508a446983bd4e872919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Sun, 15 Oct 2023 09:34:50 +0800 Subject: [PATCH] =?UTF-8?q?WAF=E8=AE=B0=E5=BD=95IP=E5=8A=A8=E4=BD=9C?= =?UTF-8?q?=E4=B8=ADIP=E5=90=8D=E5=8D=95=E5=A6=82=E6=9E=9C=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=EF=BC=8C=E9=BB=98=E8=AE=A4=E4=B8=BA=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E9=BB=91=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/waf/action_record_ip.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/waf/action_record_ip.go b/internal/waf/action_record_ip.go index 6042dc2..9295bd5 100644 --- a/internal/waf/action_record_ip.go +++ b/internal/waf/action_record_ip.go @@ -133,8 +133,13 @@ func (this *RecordIPAction) WillChange() bool { } func (this *RecordIPAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, request requests.Request, writer http.ResponseWriter) (continueRequest bool, goNextSet bool) { + var ipListId = this.IPListId + if ipListId <= 0 { + ipListId = firewallconfigs.GlobalListId + } + // 是否已删除 - var ipListIsAvailable = this.IPListId > 0 && !this.IPListIsDeleted && !ExistDeletedIPList(this.IPListId) + var ipListIsAvailable = (ipListId == firewallconfigs.GlobalListId) || (ipListId > 0 && !this.IPListIsDeleted && !ExistDeletedIPList(ipListId)) // 是否在本地白名单中 if SharedIPWhiteList.Contains("set:"+types.String(set.Id), this.Scope, request.WAFServerId(), request.WAFRemoteIP()) { @@ -167,7 +172,7 @@ func (this *RecordIPAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, re } // 上报 - if this.IPListId > 0 && ipListIsAvailable { + if ipListId > 0 && ipListIsAvailable { var serverId int64 if this.Scope == firewallconfigs.FirewallScopeService { serverId = request.WAFServerId() @@ -181,7 +186,7 @@ func (this *RecordIPAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, re select { case recordIPTaskChan <- &recordIPTask{ ip: request.WAFRemoteIP(), - listId: this.IPListId, + listId: ipListId, expiresAt: realExpiresAt, level: this.Level, serverId: serverId,