Repository navigation
2.35.4: throttle failed /admin logins (django-axes) - #1466
Merged
Merged
Conversation
Nothing limited password guessing against /admin/login/. django-axes 9.0.0 now locks a username for 30 minutes after 10 consecutive wrong passwords (HTTP 429), with counts in the database so all Gunicorn workers share them. - Keyed on username only: behind the CSE proxy the client IP is unreliable. Further guesses during a lockout do not extend it. - Axes models grouped under Administration in the admin (superuser-only). - settings_test disables axes (client.login passes no request); test_login_throttle.py re-enables it and pins the policy (7 tests). - axes.W006 (no ip_address key) silenced deliberately, with the reason. Part of #1460. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…holder usernames - Wire django-axes in only when the package is importable, so a Gunicorn worker restarted mid-deploy (old image, new checkout) still boots. - ML_DISABLE_LOGIN_THROTTLE=true (from the repository variable DISABLE_LOGIN_THROTTLE) turns throttling off without a commit; superusers see a dashboard warning whenever it is off. - Record names that match no account as one placeholder, so a password typed into the username box is never stored. - Enable the failed-login history, add an accessible lockout page, and correct the docs (rows, not row; no shell on the servers). - Tests for the placeholder, failure log, lockout page, unlock path, superuser-only admin, and the on/off switch. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Member
Author
|
Review fixes (independent Opus 5.5 review, then fixes in the latest commit) No must-fix findings. Addressed:
Follow-up, not in this PR: keying the lock on client IP as well, once the proxy's forwarding header is confirmed. 🤖 Generated with Claude Code — Fable 5.2, claude-fable-5-2 |
… tests Second review pass. Unknown usernames are now recorded as a keyed hash per name instead of one shared placeholder, so they are throttled exactly like real accounts. The off switch also accepts 1/yes/on, the lockout page says "within" N minutes, and tests now cover the switch end to end and the superuser-only dashboard warning. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Part of #1460.
What changed
Adds
django-axes9.0.0 so repeated wrong passwords at/admin/login/lock the account for a while. Standard practice for any Django admin on the public internet.Policy: 10 wrong passwords in a row lock that username for 30 minutes. A locked username gets HTTP 429 even with the right password. A correct login resets the count.
docs/ADMIN_USERS_AND_GROUPS.md.AXES_ENABLED = Falseinsettings_test.py, becauseclient.login()passes no request to the axes backend.website/tests/test_login_throttle.pyturns it back on for 7 tests covering lock, no-lock, reset, per-username isolation and the pinned policy.Verification
makemigrations axes --checkreports no changes (axes ships its own migrations; the startupmigrateapplies them), andmanage.py checkis clean apart from the deliberately silencedaxes.W006.After merge
On -test: sign in to
/adminnormally, then confirm "Access attempts" and "Access logs" appear under Administration. Local dev needs an image rebuild (requirements.txtchanged).🤖 Generated with Claude Code — Fable 5.2, claude-fable-5-2