Skip to content

Commit

Permalink
fix(security): destroy session when password reset is attempted
Browse files Browse the repository at this point in the history
The storage backend was holding onto unnecessary data that could be
used to reset passwords if the server was compromised. No outsider
has access to this storage.
  • Loading branch information
rupl committed Sep 27, 2021
1 parent 0a462d7 commit 4591c7b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/controllers/ViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,11 @@ module.exports = {
const passwordLink = _getPasswordLink(request.payload);

try {
// Whatever happens, we first want to cleanup the session storage before
// trying to reset the password.
request.yar.reset('session');

// Now attempt the password reset.
await UserController.resetPassword(request, reply);

if (params) {
Expand Down

0 comments on commit 4591c7b

Please # to comment.