-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear projects data when logging out #400
Comments
After investigating a little bit, the reason a user can still access a project after logging out, is that a jwt cookie remains in the browser after the logout action. with the cookie still present, the server will still authenticate requests. from jwt-session.js lines 32, 33
the cookie is set by the server during login and can't be deleted from the client because it is httpOnly: from jwt-session.js lines 22-27
I haven't touched the back end on this project yet, so I want to be careful about rejiggering authorization. I think the best option here is removing httpOnly when doing res.cookie, but I'm not sure what best practices dictate for security. The language of our Registration and Login read-me suggest it could be removed by the client: from register.md lines 66-70
Related:res.headers.authorization isn't showing up on the server. When setTokenInHeaders is called, it attempts to retrieve the jwt token from localStorage, but a jwt token is never set in localStorage, so the Authorization header is never set. (I didn't write the TODO, but it seems to be correct). This means as things are currently set, the jwt cookie is necessary for authorization. One possible solution to issue 400 is keeping the token in local storage and eliminating the res.cookie and req.cookies.jwt check entirely. from App.js lines 59-71
Let me know the preferred path forward. As far as I can tell removing httpOnly from the jwt cookie so it can be deleted by the client seems the most simple. The other option being removing the use of cookies and handling jwt through local storage. |
Found a simpler way to just clear the form inputs, but still believe the jwt cookie should be cleared on logout which can only be done by removing httpOnly or creating another call to the server to remove the cookie. |
Overview
User should no longer be able to access projects when logged out. Currently, the user can still access projects belonging to the logged out user.
Action Items
The text was updated successfully, but these errors were encountered: