fix: force admin password reset - #3
Conversation
Tests were failing due to a race condition when regenerating the session, fixed altogether by logging out instead
|
Hi @jescalada! Thanks for the PR. I notice a couple of things that need attention: Description clarity: The current description "Testing agentic PR review flow" doesn't explain what this change actually does or why it's needed. Could you please provide a clearer description of what the admin password reset fix addresses? Issue link: According to the contributing guidelines, PRs should link to an existing issue. Could you either link this PR to an existing issue using "Fixes #N", "Closes #N", or "Resolves #N", or create a new issue describing the problem this fixes? Looking forward to your updates! |
Automated Security ReviewSummaryTwo security issues found: a session fixation vulnerability after password change, and a path-based access control bypass via path traversal or query string manipulation. Findingssrc/service/routes/auth.ts Path-based access control bypass +const PASSWORD_CHANGE_ALLOWED_PATHS = new Set([
+ '/',
+ '/config',
+ '/login',
+ '/logout',
+ '/profile',
+ '/change-password',
+ '/openidconnect',
+ '/openidconnect/callback',
+]);
+
+router.use((req: Request, res: Response, next: NextFunction) => {
+ if (!mustChangePassword(req.user)) {
+ return next();
+ }
+
+ if (PASSWORD_CHANGE_ALLOWED_PATHS.has(req.path)) {
+ return next();
+ }Recommended fix: Audit each allowed path to confirm it exposes no sensitive data or actions to a user whose identity has not yet been fully verified (i.e., they are still using the default/compromised password). At minimum, remove src/service/routes/auth.ts Session fixation after password change + req.logout?.((err: unknown) => {
+ if (err) return next(err);
+ });
+ res.clearCookie('connect.sid');
(req.user as User).mustChangePassword = false;
res.status(200).send({ message: 'Password updated successfully' }).end();Recommended fix: Move the response inside the req.logout?.((err: unknown) => {
if (err) return next(err);
res.clearCookie('connect.sid');
res.status(200).send({ message: 'Password updated successfully' }).end();
});This ensures the old session is destroyed before the client is told the operation succeeded, preventing reuse of the pre-change session token. Disclaimer: This review is AI-generated. Please validate the findings before fixing. |
|
Thanks for the contribution! The description "Testing agentic PR review flow" does not explain what this PR actually changes or why. Could you update it to describe the problem being fixed (e.g., what the forced admin password reset addresses, what the root cause was, and how the fix works)? Please also link this PR to a relevant issue. If one does not exist yet, consider opening one first. From CONTRIBUTING.md:
Adding a |
|
/security-review |
|
Thanks for the contribution, jescalada! The PR description "Testing agentic PR review flow" does not explain what the change does or why it is needed. Could you update it to describe what the forced admin password reset fixes, what the root cause was, and how the change addresses it? Please also link this PR to a relevant issue. If one does not exist yet, consider opening one before merging. From CONTRIBUTING.md:
Adding a |
Testing agentic PR review flow