diff --git a/authentik/core/sessions.py b/authentik/core/sessions.py index 81c5c0464189..54fd64339825 100644 --- a/authentik/core/sessions.py +++ b/authentik/core/sessions.py @@ -66,9 +66,12 @@ def encode(self, session_dict): def decode(self, session_data): try: return pickle.loads(session_data) # nosec - except pickle.PickleError: - # ValueError, unpickling exceptions. If any of these happen, just return an empty - # dictionary (an empty session) + except (pickle.PickleError, AttributeError, TypeError): + # PickleError, ValueError - unpickling exceptions + # AttributeError - can happen when Django model fields (e.g., FileField) are unpickled + # and their descriptors fail to initialize (e.g., missing storage) + # TypeError - can happen with incompatible pickled objects + # If any of these happen, just return an empty dictionary (an empty session) pass return {}