You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add brute force protection for SMS verification codes
Add comprehensive brute force protection to prevent automated attacks on SMS verification codes:
- Add failed_attempts field to SMSVerification model with database migration
- Implement MAX_FAILED_ATTEMPTS setting (default: 5) for session lockout
- Implement MIN_TOKEN_LENGTH setting (default: 6) to enforce minimum security code length
- Track failed attempts for invalid, expired, and already-verified codes
- Reset failed_attempts to 0 on successful verification
- Update validation logic to check brute force limit before other validations
- Add SECURITY_CODE_TOO_MANY_ATTEMPTS status code and error handling
- Update sandbox backends to support brute force protection while maintaining test-friendly behavior
- Add comprehensive test coverage for brute force protection scenarios
- Update documentation with new security settings
Closes#100
Co-authored-by: Harsh <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.rst
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ Release Notes
6
6
7
7
Added
8
8
"""""
9
+
- **Brute Force Protection**: Added comprehensive brute force protection for SMS verification codes to prevent automated attacks. New settings: ``MAX_FAILED_ATTEMPTS`` (default: 5) for session lockout threshold and ``MIN_TOKEN_LENGTH`` (default: 6) to enforce minimum security code length. Added ``failed_attempts`` field to ``SMSVerification`` model with migration for backward compatibility. Contributed by `Harsh <https://github.com/Kaos599>`_. Closes `#100 <https://github.com/CuriousLearner/django-phone-verify/issues/100>`_.
9
10
- **Internationalization (i18n)**: Added support for localizing verification messages based on the ``Accept-Language`` HTTP header. The library now automatically detects the user's preferred language and sends verification messages in that language using Django's translation system. Contributed by `Hari Mahadevan <https://github.com/harikvpy>`_.
10
11
- **Documentation**: Completely overhauled documentation to professional, enterprise-grade quality:
0 commit comments