jaredhanson / jaredhanson/passport-http

User not logged-out when trying to log-in with incorrect password (BasicStrategy)

Open
#47 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
261
Forks
112
PR merge metrics
No merged PRs in 30d

Description

Steps to reproduce:
- have a route that requires BasicStrategy and uses session (e.g. `/api/login`),
- have a second route (with no `authenticate()`) that outputs user information from `request.user` (from session), e.g.: `/api/me`.
- log-in using the first route
- check that you get user information from the second route
- log-in with incorrect password using the first route
- you get a 401 / Unauthorized status
- check the second route: you still get user information from the second route.

Expected result:
- User is logged-out and one does not get user information from the second route.

I am not sure if this is a bug of BasicStrategy or a "feature" of Passport.js, but I think users should be forcefully logged out when trying to double-login with incorrect credentials.

Contributor guide

Open the contributing guide

Research direction

Reproduce the sequence using a route protected by BasicStrategy with session support and a second route that reads request.user. Start by tracing BasicStrategy's failed-login handling alongside Passport session state. Done means an incorrect password returns 401 and the subsequent unprotected route no longer exposes the previously authenticated user.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.