Add actions to verify signup and set password simultaneously#142
Conversation
…tests & documentation. Add commands 'verifySignupSetPasswordLong' and 'verifySignupSetPasswordShort', which mirror 'verifySignupLong' and 'verifySignupShort' but including hashing and setting the user password. Upon successful completion, call notifier 'verifySignupSetPassword'. Add tests for new commands and documentation of new commands.
|
Hi, thanks for this, it seems to be a good addition. Will have a quick look in the next few days then merge. |
|
I've just tried to merge but there was a conflict on a file so I needed to checkout locally for resolving. However, it now appears that the tests do not work, it is probably linked to the fact the module has been updated to work with Feathers v4 in the meantime. You can check my changes on this branch https://github.com/feathers-plus/feathers-authentication-management/tree/verify-signup-set-password. Could you have a look ? Thanks |
@claustres I merged the upstream changes and updated for compatibility. Let me know if you have any questions or issues. |
|
Good work, thanks. |
|
Hi @mattyg I think I have found a big security issue. Because of this line it is possible to set a password without having the right token. This line Will set the password even if token !== verifyShortToken. |
|
Hi @GautierT, thanks a lot for this important comment and the PR! I tested it locally in my app and have to verify this security issue...
This is possible only once. If you try it again, the package returns Best solution for this issue seems to be your PR #167. PS: Also, I do not see why the verification token should be deleted if someone tries a request with a wrong token. It should stay until a user is using the correct token or until it expires. Or do I miss something? |
|
It's probably not a good idea to let an attacker have chances to guess the token by performing massive tries and errors before the token expire, notably for short tokens, which are subject to brute force attack. |
|
Sounds reasonable, @claustres. That probably why the token is removed in the standard @GautierT, it is probably a good idea to update your PR and use a function like |
|
@claustres : I understand but what prevent the attacker to call @OnnoGabriel I will try to improve it now. |
|
It seems to me that if the token is changing each time you call Anyway, as discussed here (#69), a more secure option for sure is to add a rate-limit layer on top of this package. |
|
ah yes of course.
Did not though about that ! |
|
I added feathers-authentication-management/src/verify-signup.js Lines 51 to 63 in a7236d3 |
Summary
This PR implements new actions 'verifySignupSetPasswordLong' and 'verifySignupSetPasswordShort', which allow you to both verify an account and set the user password simultaneously.
This supports the account setup flow in which an administrator creates a user account without a password, and then the user sets their password and verifies their account with a single service call.
Tests and documentation are included.