style: apply ruff auto-fix
- Auto-formatted code with ruff format - Applied ruff linting fixes with --fix Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -111,9 +111,7 @@ class CSRFMiddleware(BaseHTTPMiddleware):
|
|||||||
if request.method in CSRF_PROTECTED_METHODS and request.url.path not in CSRF_EXEMPT_PATHS:
|
if request.method in CSRF_PROTECTED_METHODS and request.url.path not in CSRF_EXEMPT_PATHS:
|
||||||
submitted_token = await self._get_submitted_token(request)
|
submitted_token = await self._get_submitted_token(request)
|
||||||
if not submitted_token or not secrets.compare_digest(csrf_token, submitted_token):
|
if not submitted_token or not secrets.compare_digest(csrf_token, submitted_token):
|
||||||
logger.warning(
|
logger.warning(f"[SECURITY] CSRF_VALIDATION_FAILED method={request.method} path={request.url.path}")
|
||||||
f"[SECURITY] CSRF_VALIDATION_FAILED method={request.method} path={request.url.path}"
|
|
||||||
)
|
|
||||||
if request.url.path.startswith("/api/"):
|
if request.url.path.startswith("/api/"):
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
status_code=403,
|
status_code=403,
|
||||||
|
|||||||
Reference in New Issue
Block a user