feat(security): add Redis login rate limiting - #1632
Open
bhavyajain0810 wants to merge 1 commit into
Open
Conversation
Signed-off-by: Bhavya Jain <jainism.bhavya0810@gmail.com>
|
@bhavyajain0810 is attempting to deploy a commit to the CodeBlooded's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Hi @bhavyajain0810, thanks for contributing to Nyay Setu! 🎉 I have automatically:
Our workflows will now analyze your changes to classify:
Tip Ensure your PR description references the issue it resolves (e.g. Happy coding! 🚀 |
Contributor
Author
|
@viru0909-dev , Please review the PR #1632 |
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.
Pull Request
Description
This PR adds Redis-backed rate limiting to the password-based login endpoint to protect it against brute-force and credential-stuffing attacks across distributed backend instances.
The implementation applies two independent limits:
Account identifiers are normalized and SHA-256 hashed before being included in Redis keys, preventing plaintext email addresses from appearing in Redis key names.
Additional security and reliability improvements include:
429 Too Many Requestsresponses;Retry-After,X-RateLimit-Limit, andX-RateLimit-Remainingheaders;Closes #838
Type of change
Configuration
Tests added
Test coverage was added for:
429status and response headers;Validation note
mvn -DskipTests compilereaches compilation of the project sources but is blocked by a pre-existing issue on the clean upstream branch.The project references missing
com.networknt.schemaclasses in:GroqResponseValidator;VakilFriendGroqValidatorService.No compiler errors were reported for
RedisRateLimitServiceorAuthController, which are the production files changed by this PR.Checklist
The final checkbox remains unchecked because the existing upstream compilation failure prevents the Maven test lifecycle from running successfully. The failure is unrelated to the files changed in this PR.