pallets-eco / flask-session

Server side session extension for Flask
https://flask-session.readthedocs.io
BSD 3-Clause "New" or "Revised" License
501 stars 239 forks source link

Added session destruction and regeneration support #27

Closed twolfson closed 6 months ago

twolfson commented 8 years ago

While working with flask-session, we realized we wanted to prevent session fixation attacks. These are attacks which involve a user's session id not being rotated on login nor fully erased on logout. In order to remedy that, we are adding 2 methods:

In this PR:

Notes: It's not clear whether this should live in flask or flask-session but this was definitely the simpler solution for now. I will be opening a sibling issue on flask to get feedback.

twolfson commented 8 years ago

I am realizing that we can make the API cleaner by passing session_interface to the session constructor itself. This would allow forsession.destroy() calls which under the hood has session invoke self._interface.destroy(self).

twolfson commented 8 years ago

On the Flask thread, we concluded that it's a pretty bad idea to store anything as an attribute on session as it could get picked up by a serializer (e.g. pickle).

mmautner commented 8 years ago

:+1:

StephanDollberg commented 8 years ago

Any updates on this? I think it's pretty important and hacked something similar together for one of my projects. (Is this project even still active?)

kgritesh commented 8 years ago

Wanted to know if there is any update on this as well

jeffsuarez commented 8 years ago

👍

cowbert commented 7 years ago

Isn't this is an incomplete implementation anyway, since you only modified the Redis interface?

Lxstr commented 6 months ago

Session regeneration should be provided in flask 0.7.0, 0.7.0rc2 is now available with session_interface.regenerate(). It seems we don't need the destroy method as session.clear() should now result in session data being deleted as _permanent is ignored in boolean evaluation of session. Reopen a new issue if anyone believes a specific destroy function is needed.