Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions django/contrib/sessions/backends/el_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def decode(self, session_data):
def _decode_with_single_key(self, hash_val, serialized):
expected_hash = self._hash(serialized)
if not constant_time_compare(hash_val.decode(), expected_hash):
# logging using print because there is no logger here
print("Session data is corrupted!")
raise SuspiciousOperation("Session data corrupted")

return self.serializer().loads(serialized)
Expand All @@ -57,4 +59,6 @@ def _decode_with_multiple_keys(self, hash_val, serialized):
# If here, that means session got decoded
return self.serializer().loads(serialized)
# If here, then we've exhausted all the keys, raise Exception
# logging using print because there is no logger here
print("Session data is corrupted!")
raise SuspiciousOperation("Session data corrupted")