feat(auth): add rate limiting to signup, login, and google-login#1450
Open
Honey-pg wants to merge 1 commit into
Open
feat(auth): add rate limiting to signup, login, and google-login#1450Honey-pg wants to merge 1 commit into
Honey-pg wants to merge 1 commit into
Conversation
Layer IP and email limits on public auth endpoints and enable trust proxy so rate limiting works correctly behind Render.
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.
Layer IP and email limits on public auth endpoints and enable trust proxy so rate limiting works correctly behind Render.
📌 Description
Adds rate limiting to
/signup,/login, and/google-loginto reduce brute-force login attempts, credential stuffing, and signup spam. Limits follow the existing 2FA pattern with a generic error message that does not reveal which limit was hit.🔗 Related Issue
Closes #1418
🛠 Changes Made
authByIpLimiter(10 requests / 15 min per IP) for/signup,/login, and/google-loginauthByEmailLimiter(5 requests / 15 min per normalized email) for/signupand/loginipKeyGeneratorfor IPv6-safe IP keys (express-rate-limit v8)trust proxyinserver.jsso IP-based limits work behind Render📸 Screenshots (if applicable)
N/A — backend-only change, no UI updates.
✅ Checklist
🚀 Notes for Reviewers
/google-loginis IP-limited only because email is inside the Firebase token and is not available before verification."Too many attempts, please try again later"message andRateLimit-*headers.#<issue_number>with the assigned GSSoC issue before opening the PR.