Security issue with only generating link using only signed user pk #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note this is only a mitigation fix
Scenario
If we only generate the reset link using expiry link and max age, with in the expiry period, anybody with view of the reset link can gain access to the user account.
e.g. if I have access to the browser history since it is a public computer within the expiry period, i can access the reset link and gain access to the account.
I have proposed an example fix with signing with also the password hash. However this fix is just a mitigation. If user reset password with the same password, then this will still be an issue.
Safety in signing the password
Also note that we have hashed the password to be signed, in case if user didnt encrypt their password to prevent accidental leakage.
Help
Do you have any suggestions for a better fix?