Skip to content

Conversation

@Leon-JavaScript
Copy link
Member

This PR refactors the login endpoint to enhance security against timing attacks. When a user does not exist, a dummy password hash is used for verification, ensuring that password checks always take approximately the same time regardless of user existence. Both user existence and password validity are checked together, maintaining constant timing and preventing attackers from inferring valid users based on response time. This change improves authentication security without affecting user experience.

…sh for non-existent users and ensuring constant timing for password verification
@Leon-JavaScript Leon-JavaScript added this to the v1.0.2 milestone Jan 10, 2026
@Leon-JavaScript Leon-JavaScript self-assigned this Jan 10, 2026
@Leon-JavaScript Leon-JavaScript added the Priority: High Should take care of soon label Jan 10, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the login endpoint to mitigate timing attacks by ensuring password verification takes constant time regardless of whether a user exists. The implementation uses a dummy password hash for non-existent users and checks both user existence and password validity together before returning an error.

Changes:

  • Removed early return when user doesn't exist
  • Added dummy password hash for non-existent users to maintain constant verification time
  • Combined user existence and password validity checks into a single conditional

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: High Should take care of soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants