Repository navigation
fix(login): successful logins do not use up the IP's rate limit (1.3.1) - #11
Merged
Merged
Conversation
10 logins per IP per 15 minutes counted successes too, so the 11th member of staff on one office connection was locked out with RATE_LIMITED. Every attempt is still counted before verification (bursts stay blocked); a successful login now takes its IP hit back (RateLimiter.undo, optional; memory and Redis limiters implement it). Per-email limits are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Bj7Tb5PweikTen79CdVH4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Himanshu · project thread
Problem
loginhitslogin:ip:<ip>(10 per 15 min in the api) before checking the password, and only the email key is reset on success. Successful logins therefore used up the IP's budget. In the local end-to-end test, 10 correct sign-ins from one IP were followed byRATE_LIMITEDfor 15 minutes. At a branch where all staff share one internet connection, the 11th person to sign in during a shift change gets locked out.Fix
RateLimitergets an optionalundo(key)that takes back the latest hit.memoryRateLimiterpops it andredisRateLimiterusesZPOPMAX.logincallslimiter.undo?.("login:ip:<ip>").undokeeps the old behaviour.Tests
New check, run on both the memory and the Redis (ioredis-mock) limiters, with a 3-per-window limit: 6 successful logins from one IP all succeed, and 3 failures from that IP still lead to
RATE_LIMITEDon the 4th.npm run typecheckpasses andnpm testgives 128 passed, 0 failed. Version 1.3.1; README, AGENTS.md andllms-full.txtupdated.After merge: tag
v1.3.1, then the api moves to^1.3.1.Generated by Claude Code