-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Don't use hash to check if binding worked #32246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
come-nc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
This sum could be of dn+prefix+pwd to test if the bind was with the same parameters in one comparison. |
a521e0b to
e3e3e6e
Compare
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. |
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. |
e3e3e6e to
0648ecc
Compare
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, so use a fast hashing algorythm. Signed-off-by: Carl Schwan <[email protected]>
0648ecc to
95b5187
Compare
PVince81
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
/backport to stable23 |
|
/backport to stable22 |
|
/backport to stable24 |
|
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: