Uh oh!
There was an error while loading. Please reload this page.
Don't use hash to check if binding worked - #32246
Conversation
come-nc
left a comment
There was a problem hiding this comment.
Maybe name it sum instead of hash and use a fast checksum method like sha instead?
I dislike storing the clear password in a random variable, it might cause problems down the road.
come-nc
commented
May 3, 2022
This sum could be of dn+prefix+pwd to test if the bind was with the same parameters in one comparison. |
a521e0b to
e3e3e6eCompareCarlSchwan
commented
May 3, 2022
I switched to an md5 hash instead. It's still quite useless in my opinion since the password is already accessible in clear from the app config database, so adding a hash to compare two strings is not required even if the string is confidential. At least with md5, the hashing will be quite a bit faster. |
come-nc
commented
May 3, 2022
Yeah I know we store the data but the idea is to not have it in too many variables to not encourage its use everywhere, and be able to track each use by looking at configuration reads. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
e3e3e6e to
0648eccCompareUsing password_hash is expensive and should be used for hashing passwords when saving them in the database. Here we just want to see if the bind was already done with the given password, so use a fast hashing algorythm. Signed-off-by: Carl Schwan <carl@carlschwan.eu>
0648ecc to
95b5187CompareCarlSchwan
commented
May 5, 2022
/backport to stable23 |
CarlSchwan
commented
May 5, 2022
/backport to stable22 |
CarlSchwan
commented
May 5, 2022
/backport to stable24 |
blizzz
commented
May 5, 2022
sha256 over md5 to be more robust against collisions |
using password_hash is expensive and should be used for hashing
passwords when saving them in the database. Here we just want to see if
the bind was already done with the given password.
Time spent on testing.nextcloud.com for password hashing 160ms: