Skip to content

Node.js based forum software built for the modern web

feat: roll session identifier on login, as security best practice

Julian Lam697ed3bf37fe
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js
index a9263ffe72..0542355bb6 100644
--- a/src/controllers/authentication.js
+++ b/src/controllers/authentication.js
@@ -326,6 +326,9 @@ authenticationController.doLogin = async function (req, uid) {
return;
}
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 authenticationController.onSuccessfulLogin(req, uid);
};