From a096d04d0493e938c73866e1ee81f6f1a5aa8982 Mon Sep 17 00:00:00 2001 From: Jonas Kaninda Date: Thu, 14 Nov 2024 15:06:10 +0100 Subject: [PATCH] refactor logging --- internal/middleware/block-common-exploits.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/middleware/block-common-exploits.go b/internal/middleware/block-common-exploits.go index b3f8f2b..7c09ffb 100644 --- a/internal/middleware/block-common-exploits.go +++ b/internal/middleware/block-common-exploits.go @@ -41,7 +41,7 @@ func BlockExploitsMiddleware(next http.Handler) http.Handler { pathTraversalPattern.MatchString(r.URL.Path) || xssPattern.MatchString(r.URL.RawQuery) { logger.Error("%s: %s Forbidden - Potential exploit detected", getRealIP(r), r.URL.Path) - RespondWithError(w, http.StatusForbidden, fmt.Sprintf("%d Forbidden - Potential exploit detected", http.StatusForbidden)) + RespondWithError(w, http.StatusForbidden, fmt.Sprintf("%d Forbidden", http.StatusForbidden)) return } @@ -52,7 +52,7 @@ func BlockExploitsMiddleware(next http.Handler) http.Handler { for _, value := range values { if sqlInjectionPattern.MatchString(value) || xssPattern.MatchString(value) { logger.Error("%s: %s %s Forbidden - Potential exploit detected", getRealIP(r), r.Method, r.URL.Path) - RespondWithError(w, http.StatusForbidden, fmt.Sprintf("%d Forbidden - Potential exploit detected", http.StatusForbidden)) + RespondWithError(w, http.StatusForbidden, fmt.Sprintf("%d Forbidden", http.StatusForbidden)) return } }