Feat: Progressive/tiered lockouts based on failure count#1402
Open
rodrigobnogueira wants to merge 4 commits intojazzband:masterfrom
Open
Feat: Progressive/tiered lockouts based on failure count#1402rodrigobnogueira wants to merge 4 commits intojazzband:masterfrom
rodrigobnogueira wants to merge 4 commits intojazzband:masterfrom
Conversation
…s based on failure count.
5695188 to
7eef2f1
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1402 +/- ##
==========================================
+ Coverage 91.56% 91.90% +0.34%
==========================================
Files 37 37
Lines 1268 1322 +54
Branches 172 183 +11
==========================================
+ Hits 1161 1215 +54
Misses 83 83
Partials 24 24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
Hey, looks good, thanks, but this is a handful to review and a brand-new feature at that. I'll try to set some time aside later on for checking this out. |
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.
What does this PR do?
This PR introduces the ability to configure progressive (tiered) lockouts in django-axes. Instead of a single fixed cool-off time, the system now supports escalating lockout durations based on the number of failed attempts.
Changes
LockoutTierdataclass and theAXES_LOCKOUT_TIERSsetting to configure the tiers inaxes.conf.get_cool_off,get_failure_limit,get_lockout_message,get_lockout_response) inaxes.helpersto resolve and apply the appropriate tier based on a request'saxes_failures_since_startcount.axes.checksto warn users ifAXES_LOCKOUT_TIERSis misconfigured or used alongsideAXES_COOLOFF_TIME.AXES_LOCKOUT_TIERStodocs/4_configuration.rst.How it works
Users can configure
AXES_LOCKOUT_TIERSas a list ofLockoutTierinstances. For example:When
AXES_LOCKOUT_TIERSis defined, it overrides bothAXES_FAILURE_LIMIT(which becomes the threshold of the lowest tier) andAXES_COOLOFF_TIME. Lockouts are subsequently applied dynamically according to the rules defined in the tiers.All existing behavior remains completely unchanged if
AXES_LOCKOUT_TIERSis not set.Before submitting