RocketChat / RocketChat/Rocket.Chat
IP whitelist for failed-login protection does not trim spaces, so valid whitelisted IPs can still get blocked
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
When Block_Multiple_Failed_Logins_Ip_Whitelist contains comma-separated IPs with spaces after commas, Rocket.Chat does not trim the values before checking membership. As a result, whitelisted IPs can still be blocked by failed-login protection.
Affected file
apps/meteor/app/authentication/server/lib/restrictLoginAttempts.ts
Relevant code
const whitelist = String(settings.get('Block_Multiple_Failed_Logins_Ip_Whitelist')).split(',');
if (
!settings.get('Block_Multiple_Failed_Logins_Enabled') ||
!settings.get('Block_Multiple_Failed_Logins_By_Ip') ||
whitelist.includes(ip)
) {
return true;
}
Steps to reproduce
- Enable
Block_Multiple_Failed_Logins_Enabled. - Enable
Block_Multiple_Failed_Logins_By_Ip. - Set
Block_Multiple_Failed_Logins_Ip_Whitelistto something like:127.0.0.1, 192.168.0.10 - Attempt repeated failed logins from
192.168.0.10.
Expected behavior
192.168.0.10 should be treated as whitelisted and should bypass IP-based failed-login blocking.
Actual behavior
The IP may still be blocked because the whitelist entry is stored as ' 192.168.0.10' and compared using exact string equality.
Root cause
The whitelist is split on commas but never normalized with .trim().
Suggested fix
Normalize the whitelist values before comparison, for example:
const whitelist = String(settings.get('Block_Multiple_Failed_Logins_Ip_Whitelist'))
.split(',')
.map((entry) => entry.trim())
.filter(Boolean);
Impact
- Admins can think an IP is whitelisted when it is not.
- Lockout behavior becomes inconsistent and hard to diagnose.
- Common comma-and-space formatting in settings silently breaks the feature.
This one is cleaner and less likely to already be raised than the earlier candidate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in apps/meteor/app/authentication/server/lib/restrictLoginAttempts.ts and review how the comma-separated IP whitelist is parsed before membership is checked. Reproduce the settings scenario with a space after a comma, then verify that the listed IP bypasses IP-based failed-login blocking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100