Skip to content

Session Identifier Stored in Cookie during Logout #84

Open
@tianjk99

Description

@tianjk99

Please check if there is any problem.
The code in the file "user.js" at the path "innovate-digital-bank/portal/routes" includes a logout endpoint ("/endpoints/logout") that stores the session identifier (sid) in a cookie during the logout process. While this approach may not pose an immediate security risk, it is important to address potential vulnerabilities and follow security best practices.
res.cookie("connect.sid", "", {expires: new Date()});
Currently, the code clears the "connect.sid" cookie and destroys the session. However, it does not generate a new session identifier after the logout, which could leave the application vulnerable to session fixation attacks. In a session fixation attack, an attacker could obtain the session identifier before the session is destroyed and use it to impersonate the user.
It is advisable to implement secure cookie options by setting the "Secure" flag to true to ensure the cookie is only transmitted over HTTPS, and the "HttpOnly" flag to true to prevent client-side script access to the cookie.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions