Skip to content

Commit

Permalink
Changed models.auth.Session.get_session_from_cookie to raise SessionD…
Browse files Browse the repository at this point in the history
…oesNotExist instead of SuspiciousOperation if tamper check fails

git-svn-id: http://code.djangoproject.com/svn/django/trunk@234 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Jul 20, 2005
1 parent d384870 commit 526f6af
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions django/models/auth.py
Expand Up @@ -213,8 +213,7 @@ def _module_get_session_from_cookie(session_cookie_string):
raise SessionDoesNotExist raise SessionDoesNotExist
session_md5, tamper_check = session_cookie_string[:32], session_cookie_string[32:] session_md5, tamper_check = session_cookie_string[:32], session_cookie_string[32:]
if md5.new(session_md5 + SECRET_KEY + 'auth').hexdigest() != tamper_check: if md5.new(session_md5 + SECRET_KEY + 'auth').hexdigest() != tamper_check:
from django.core.exceptions import SuspiciousOperation raise SessionDoesNotExist
raise SuspiciousOperation, "User may have tampered with session cookie."
return get_object(session_md5__exact=session_md5, select_related=True) return get_object(session_md5__exact=session_md5, select_related=True)


def _module_destroy_all_sessions(user_id): def _module_destroy_all_sessions(user_id):
Expand Down

0 comments on commit 526f6af

Please sign in to comment.