Django

Code

Ticket #2133 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

[patch] Invalid session cookies shouldn't cause fatal errors

Reported by: greg-django@abbas.org Assigned to: adrian
Milestone: Component: Core framework
Version: SVN Keywords: session, security, cookie
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

It seems a little harsh to halt processing of a request whenver the client's session cookie doesn't match the app's SECRET_KEY properly. I ran into this issue because I started development on a new project based on a previous one, and then remembered that I needed to make a new SECRET_KEY. I couldn't use my app at all, until I manually deleted the cookie from every browser I had been using. I suggest that when the server sees an invalid cookie, it should just delete the key and the session cache, because one of two things is probably going on:

  1. The site admin legitimately changed the secret key (and users shouldn't be impacted more than necessary), or
  2. Someone is trying to hack the site (and then, although it's not a big deal, we don't owe them the favor of explaining the nature of the error to them).

I suggest perhaps adding a variable in settings.py, just in case some folks like the old behavior.

Attachments

session.diff (3.1 kB) - added by greg-django@abbas.org on 06/11/06 16:40:09.
patch for SVN trunk

Change History

06/11/06 16:40:09 changed by greg-django@abbas.org

  • attachment session.diff added.

patch for SVN trunk

06/11/06 16:46:15 changed by anonymous

  • summary changed from Invalid session cookies shouldn't cause fatal errors to [patch] Invalid session cookies shouldn't cause fatal errors.

01/17/07 20:23:09 changed by Simon G. <dev@simon.net.nz>

  • stage changed from Unreviewed to Ready for checkin.

I think the silent-ignore behavior is the best & safest solution, and probably does not require the addition to settings?

01/24/07 18:45:30 changed by adrian

I agree that silent-ignore behavior is best and safest. I'll update the patch and check it in.

01/24/07 18:47:57 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

(In [4423]) Fixed #2133 -- Invalid session cookie no longer causes fatal error. Thanks, greg-django@abbas.org


Add/Change #2133 ([patch] Invalid session cookies shouldn't cause fatal errors)




Change Properties
Action