auth/password: implement a digest class for bcrypt that handles salt correctly#150
auth/password: implement a digest class for bcrypt that handles salt correctly#150wchristian wants to merge 5 commits intopreaction:masterfrom
Conversation
…correctly In short, for salts to work properly, every time a password is set, a new salt needs to be used, which maximizes the runtime cost for an attacker who acquires the database.
|
My first thought was «Why are you using On second thought, there are much bigger issues. I would suggest just dropping support for plain digests entirely: they are not a secure way of storing passwords and have not been for a long time. You're better off just going straight to If you want more flexibility I'd recommend you |
There are answers to this that are closer to the surface, but the core answer is: Because i walked into an existing project, i tried to minimize the changes that would need to be done to Yancy::Plugin::Auth::Password, and Eksblowfish made implementing that easiest for me yesterday. If you can look at BcryptYancy and wanna recommend some concrete changes, i'll be happy to take 'em. :)
I agree, however that would, as mentioned, require a complete rewrite of Auth::Password, and just having walked into the door, not something i can suggest.
On recommendation of mst, I'm actually planning to make Digest::Passphrase, if only because i'd also like to have password hashing that isn't limited to 72 bytes, but also because it would generally be useful to have that wrapped in a way that it can slot into places that expect Digest::. It probably would also make BcryptYancy entirely obsolete, but i'm not there yet. |
In short, for salts to work properly, every time a password is set, a new salt needs to be used, which maximizes the runtime cost for an attacker who acquires the database.
This also required passing the current password all the way through to the digest object in order to make password checking possible at all, which makes part of the diff a bit ugly.
However otherwise i tried to keep things as short and simple as possible, and i'm not married to any of the implementation if y'all would prefer things to be done differently.