refactor logging
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user