After renewed interest because of potential database timing attacks (
T31412) I'm looking into an existing PR (
PR8736 for
T21076) for adding the possibility of storing hashes of session keys.
I'm looking to get some feedback on two things;
After going through the existing commits of Chris Griffin, I agree with Aymeric Augustin (who did an initial review of the pull request) that there should be a clearer distinction between the incoming session key (Aymeric talks about a "clear text session key") and the key that gets stored in the sessions backend (Aymeric talks about a "hashed if needed session key").
I'm suggesting to use the names frontend_key and backend_key for these two concepts.
My second suggestion is to refactor the SessionBase class to make sure the session-key-hashing happens in one place and isn't spread across all different backend implementations as is the case now because the subclasses have to implemented public methods that receive the frontend_key. I'm suggesting to basically have subclasses implement private methods that receive a backend_key, which will be invoked by the public methods in the BaseClass. Obviously this will have consequences for any existing custom backends out there, though I think those will be affected either way.
I welcome any thoughts on both the naming convention and the refactoring.