-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat: allow other password hashing algorithms #580
Conversation
41baf7e
to
60febb4
Compare
|
||
switch (hashConfig.algorithm) { | ||
case HtpasswdHashAlgorithm.bcrypt: | ||
hash = bcrypt.hashSync(passwd, hashConfig.rounds); |
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.
generateHtpasswdLine
is used in asynchronous changePasswordToHTPasswd
, so I think it would be great to use asynchronous bcrypt.hash
instead of bcrypt.hashSync
to prevent blocking and make this function async
.
I can try to do this in a separate PR :)
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.
Does bcrypt.hash
worked out last time? I barely remember there were few issues with it. Doens't? In anyway, LGTM for a separated PR, I think won't break any API.
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.
I tried, and it seemed to work according to tests. Please, take a look here:
#589
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.
LGTM
Thanks @greshilov for the review, really appreciated 💯 |
Type: feat
Scope: plugin
The following has been addressed in the PR:
Description:
copied from v6 plugins by @greshilov verdaccio/verdaccio#2072
Context
The current implementation of the
htpasswd
module supports multiple hash formats on verify, but onlycrypt
on sign in.crypt
is an insecure old format, so to improve the security of the newverdaccio
release we introduce the support of multiple hash algorithms on sign in step.New hashing algorithms
The new possible hash algorithms to use are
bcrypt
,md5
,sha1
.. You can read more about them here.bcrypt
is chosen as a default, because of its customizable complexity and overall reliabilityTwo new properties are added to
auth
section in the configuration file:algorithm
to choose the way you want to hash passwords.rounds
is used to determinebcrypt
complexity. So one can improve security according to increasing computational power.Example of the new
auth
config file section: