fix(api): count sign-in failures per email and IP so strangers cannot lock a Player out #546
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
spec
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amaurycoudr/chess-project!546
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/436-sign-in-lockout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Sign-in failures are now counted per email and IP, so five wrong passwords from a stranger no longer refuse the real Player from their own address. The per-IP limit is unchanged.
The limit is renamed, and so is its override:
RATE_LIMIT_SIGN_IN_FAILURES_PER_EMAILbecomesRATE_LIMIT_SIGN_IN_FAILURES_PER_EMAIL_AND_IP. No deploy file or script sets the old name.Evidence
apps/api/test/rpc-rate-limits.integration.test.tsfails: After: it passes. The sixth attempt from the guessing address is still refused, even with the right password, and a burst from one address still lets only five reach the password check. The gate is green.Merge Danger
Door: two-way
Reverting restores the old key. In-memory counters reset on deploy anyway (ADR 0041).
Blast Radius: sign-in
This trades the owner lockout for a looser cap on one email: failures spread across many addresses are now capped only at 5 per address, and the per-IP limit of 20 still applies to each address. Any environment that sets the old variable name outside the repo silently falls back to the default of 5.
Proposed rule changes
ADR 0041 says "Counters are keyed by IP and by lowercased email". Sign-in failures are now keyed by lowercased email together with IP, so failures from other addresses never refuse a caller who did not fail (#436). An amendment should record this and the distributed-guessing trade-off above.
deploy/compose.preview.yamlandscripts/assign-dev-rate-limits.shstill say "per-email limits". That remains true of what they mean (those limits keep production values), but the comments could say "per-email and per-email-and-IP".Closes #436
Screenshots
Before is production, after is this merge request's review app at
b39aa75.Desktop
Mobile
added 23 commits
mainbca4cd91- fix(api): count sign-in failures per email and IP so strangers cannot lock a Player outb39aa755- refactor(api): build the sign-in failure key in the order its limit names itCompare with previous version
mentioned in issue #439
mentioned in commit fe9f2e3bbb8c9c7f21fad05879afbe9f7de459de
mentioned in merge request !549
mentioned in commit
56cc57afdc