fix: exempt /api/v1/errors from CSRF for frontend error logging
This commit is contained in:
@@ -45,7 +45,7 @@ class CSRFMiddleware(BaseHTTPMiddleware):
|
|||||||
# 2. CSRF token validation (double-submit pattern)
|
# 2. CSRF token validation (double-submit pattern)
|
||||||
# Skip CSRF token check for auth endpoints (login/password-reset)
|
# Skip CSRF token check for auth endpoints (login/password-reset)
|
||||||
path = request.url.path
|
path = request.url.path
|
||||||
if path.endswith("/auth/login") or path.endswith("/auth/logout") or "/password-reset" in path:
|
if path.endswith("/auth/login") or path.endswith("/auth/logout") or "/password-reset" in path or path.endswith("/api/v1/errors") or path == "/api/v1/errors":
|
||||||
return await call_next(request)
|
return await call_next(request)
|
||||||
|
|
||||||
csrf_header = request.headers.get("x-csrf-token")
|
csrf_header = request.headers.get("x-csrf-token")
|
||||||
|
|||||||
Reference in New Issue
Block a user