mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-21 07:50:37 +01:00
feat: roll session identifier on login, as security best practice
see: https://owasp.org/www-community/attacks/Session_fixation
This commit is contained in:
@@ -326,6 +326,9 @@ authenticationController.doLogin = async function (req, uid) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const loginAsync = util.promisify(req.login).bind(req);
|
const loginAsync = util.promisify(req.login).bind(req);
|
||||||
|
const regenerateSession = util.promisify(req.session.regenerate).bind(req.session);
|
||||||
|
|
||||||
|
await regenerateSession();
|
||||||
await loginAsync({ uid: uid });
|
await loginAsync({ uid: uid });
|
||||||
await authenticationController.onSuccessfulLogin(req, uid);
|
await authenticationController.onSuccessfulLogin(req, uid);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user