From 18d9fbf4090261aa0658c2e16f27c8af0ef73b22 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Tue, 28 Nov 2023 20:39:42 +0800 Subject: [PATCH] =?UTF-8?q?WAF=E9=AA=8C=E8=AF=81=E7=A0=81=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=90=8E=E8=BF=94=E5=9B=9E=E6=97=B6=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=B7=B2=E9=80=9A=E8=BF=87=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/waf/captcha_validator.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/waf/captcha_validator.go b/internal/waf/captcha_validator.go index 7346192..5eb5dcf 100644 --- a/internal/waf/captcha_validator.go +++ b/internal/waf/captcha_validator.go @@ -99,12 +99,18 @@ func (this *CaptchaValidator) Run(req requests.Request, writer http.ResponseWrit } else { // 增加计数 CaptchaIncreaseFails(req, captchaActionConfig, policyId, groupId, setId, CaptchaPageCodeShow) - this.show(captchaActionConfig, req, writer, captchaType) + this.show(captchaActionConfig, setId, originURL, req, writer, captchaType) } } } -func (this *CaptchaValidator) show(actionConfig *CaptchaAction, req requests.Request, writer http.ResponseWriter, captchaType firewallconfigs.ServerCaptchaType) { +func (this *CaptchaValidator) show(actionConfig *CaptchaAction, setId int64, originURL string, req requests.Request, writer http.ResponseWriter, captchaType firewallconfigs.ServerCaptchaType) { + // validated yet? + if SharedIPWhiteList.Contains(wafutils.ComposeIPType(setId, req), actionConfig.Scope, req.WAFServerId(), req.WAFRemoteIP()) { + http.Redirect(writer, req.WAFRaw(), originURL, http.StatusSeeOther) + return + } + switch captchaType { case firewallconfigs.CaptchaTypeOneClick: this.showOneClickForm(actionConfig, req, writer)