Make sessions more robust
|Reported by:||Paul McMillan||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In #17810, we fixed a specific problem where an invalid session cookie could result in a server error. Since this has the effect of locking a user out of an application permanently (the site just appears broken) until they clear their cookies, this is pretty undesirable.
This ticket is to improve and expand that protection. We should change the contract around sessions to be more robust. I suggest something along the lines of "if there is any kind of error during any operation related to a session, we log the problem and push a brand new session to the user."
This will mean that cases where an invalid session can exist (as in the previous ticket by an overly long session key, or one could imagine situations with broken pickled session data) don't wedge the user experience. We should (carefully) extend the protection added there to cover sessions more generally, including session creation, deletion, and access, across all backends. This will, of course, need to be balanced with providing useful error messages to developers.