feat: enhanced authentication by adding #797
Closed
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.
Description
Motivation and Context
FIX #
Screenshots
API Changes
Change Type
Testing Performed
Checklist
High-level PR Summary
This PR enhances the authentication security by implementing rate limiting on authentication endpoints (login, registration, and password reset) to prevent brute force attacks and user enumeration. It introduces specific error handling to distinguish between non-existent accounts (
LOGIN_USER_NOT_FOUND) and incorrect passwords, uses Redis-backed rate limiting with SlowAPI middleware, and updates the frontend to handle the new error codes. The changes also improve logging for security monitoring and remove redundant toast notifications from the login form.⏱️ Estimated Review Time: 30-90 minutes
💡 Review Order Suggestion
surfsense_backend/pyproject.tomlsurfsense_backend/uv.locksurfsense_web/lib/auth-errors.tssurfsense_backend/app/users.pysurfsense_web/app/(home)/login/LocalLoginForm.tsxsurfsense_backend/app/app.py