Skip to content

Commit b25e5c3

Browse files
committed
chores
1 parent c4cdd3c commit b25e5c3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

backend/app/core/security.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from app.schemas.user import UserInDB
88
from fastapi import Depends, HTTPException, Request, status
99
from fastapi.security import OAuth2PasswordBearer
10-
from itsdangerous import URLSafeTimedSerializer
1110
from passlib.context import CryptContext
1211

1312
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/v1/login")
@@ -112,15 +111,14 @@ def validate_csrf_token(request: Request) -> str:
112111

113112
# Get CSRF token from header and cookie
114113
header_token = request.headers.get("X-CSRF-Token")
115-
cookie_token = request.cookies.get("csrf_token")
116-
114+
cookie_token = request.cookies.get("csrf_token", "")
115+
117116
if not header_token:
118117
raise HTTPException(
119118
status_code=status.HTTP_403_FORBIDDEN,
120119
detail="CSRF token missing"
121120
)
122121

123-
# Validate using double-submit cookie pattern
124122
if not security_service.validate_csrf_token(header_token, cookie_token):
125123
raise HTTPException(
126124
status_code=status.HTTP_403_FORBIDDEN,

0 commit comments

Comments
 (0)