Skip to content

Commit

Permalink
fix: Catch invalid token
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Sep 16, 2024
1 parent 1a359d6 commit 583b3db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nexus/core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from base64 import b64decode, b64encode
from typing import Union

from cryptography.fernet import Fernet
from cryptography.fernet import Fernet, InvalidToken
from itsdangerous import BadSignature
from redis import asyncio as aioredis
from starlette.datastructures import MutableHeaders
Expand Down Expand Up @@ -46,7 +46,7 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
scope["__ssid"] = sessionId
scope["__sskey"] = sessionKey
initial_session_was_empty = False
except (BadSignature, AttributeError):
except (BadSignature, AttributeError, InvalidToken):
scope["session"] = {}
else:
scope["session"] = {}
Expand Down

0 comments on commit 583b3db

Please sign in to comment.