RocketChat / RocketChat/Rocket.Chat

Plan: Enhance Login Protection and Fix Email Bypass

Open
#40,195 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug type: feature
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

This plan addresses a security gap where login protection is bypassed when using email addresses for login, and improves the IP whitelist to support CIDR ranges.

User Review Required

[!IMPORTANT]
The fix for email-based login protection will now block failed login attempts against a specific email address, which was previously missing. This enhances security but may change behavior for users who frequently mistype their passwords when logging in with email.

Proposed Changes

Authentication Logic
[MODIFY] restrictLoginAttempts.ts
  • Update isValidAttemptByUser to extract either username or email from login.methodArguments[0].user.
  • Update saveFailedLoginAttempts to capture the email if username is unavailable in the method arguments.
  • Import isIpInCidrRange from @rocket.chat/server-fetch to support CIDR matching in isValidLoginAttemptByIp.

Verification Plan

Automated Tests
  • I will create or update unit tests for restrictLoginAttempts.ts to verify:
    • Failed logins with email are correctly blocked after the threshold.
    • CIDR ranges in the whitelist correctly allow access.
Manual Verification
  • I'll simulate failed login attempts using the LoginProtection logger to verify that the correct identifiers are being processed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/meteor/app/authentication/server/lib/restrictLoginAttempts.ts and read isValidAttemptByUser, saveFailedLoginAttempts, and isValidLoginAttemptByIp. Review the existing unit tests for restrictLoginAttempts.ts before running them. Done means email-based failed logins are blocked at the threshold and CIDR ranges in the whitelist allow access, with logger-based manual verification of identifiers.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authentication, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.