From 3e744ef9c7b8d320d5435e61a794fee310592995 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Thu, 16 Mar 2023 10:38:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8GET302=E5=92=8CCAPTCHA=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E4=B8=AD=E4=B8=8D=E8=AE=B0=E5=BD=95=E7=89=B9=E6=AE=8A?= =?UTF-8?q?URL=E7=9A=84=E8=AE=BF=E9=97=AE=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_waf.go | 5 +++++ internal/waf/requests/request.go | 3 +++ internal/waf/requests/test_request.go | 8 ++++++++ internal/waf/waf.go | 2 ++ 4 files changed, 18 insertions(+) diff --git a/internal/nodes/http_request_waf.go b/internal/nodes/http_request_waf.go index 9b524f9..47d0e56 100644 --- a/internal/nodes/http_request_waf.go +++ b/internal/nodes/http_request_waf.go @@ -421,3 +421,8 @@ func (this *HTTPRequest) WAFFingerprint() []byte { return nil } + +// DisableAccessLog 在当前请求中不使用访问日志 +func (this *HTTPRequest) DisableAccessLog() { + this.disableLog = true +} diff --git a/internal/waf/requests/request.go b/internal/waf/requests/request.go index 2ad5f1f..ed275b1 100644 --- a/internal/waf/requests/request.go +++ b/internal/waf/requests/request.go @@ -37,4 +37,7 @@ type Request interface { // Format 格式化变量 Format(string) string + + // DisableAccessLog 在当前请求中不使用访问日志 + DisableAccessLog() } diff --git a/internal/waf/requests/test_request.go b/internal/waf/requests/test_request.go index ab9b218..2482bf9 100644 --- a/internal/waf/requests/test_request.go +++ b/internal/waf/requests/test_request.go @@ -76,3 +76,11 @@ func (this *TestRequest) Format(s string) string { func (this *TestRequest) WAFOnAction(action interface{}) bool { return true } + +func (this *TestRequest) WAFFingerprint() []byte { + return nil +} + +func (this *TestRequest) DisableAccessLog() { + +} diff --git a/internal/waf/waf.go b/internal/waf/waf.go index 6d6975c..609cfe7 100644 --- a/internal/waf/waf.go +++ b/internal/waf/waf.go @@ -250,12 +250,14 @@ func (this *WAF) MatchRequest(req requests.Request, writer http.ResponseWriter) // validate captcha var rawPath = req.WAFRaw().URL.Path if rawPath == CaptchaPath { + req.DisableAccessLog() captchaValidator.Run(req, writer) return } // Get 302验证 if rawPath == Get302Path { + req.DisableAccessLog() get302Validator.Run(req, writer) return }