fix: backend error interceptor

This commit is contained in:
Jonas Kaninda
2024-11-14 14:41:10 +01:00
parent 5951616153
commit 949667cc60
6 changed files with 12 additions and 26 deletions

View File

@@ -19,18 +19,13 @@ package middleware
import (
"fmt"
errorinterceptor "github.com/jkaninda/goma-gateway/pkg/errorinterceptor"
"github.com/jkaninda/goma-gateway/pkg/logger"
"net/http"
"regexp"
)
type BlockCommon struct {
ErrorInterceptor errorinterceptor.ErrorInterceptor
}
// BlockExploitsMiddleware Middleware to block common exploits
func (blockCommon BlockCommon) BlockExploitsMiddleware(next http.Handler) http.Handler {
func BlockExploitsMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Patterns to detect SQL injection attempts
sqlInjectionPattern := regexp.MustCompile(sqlPatterns)