Commit graph

56 commits

Author SHA1 Message Date
Maksim Zayakin
73c4e4501b chore: adjust types: use list instead of iterables and nested lists instead of tuples 2023-05-13 14:04:14 +03:00
Maksim Zayakin
476d3f52bc chore: use get_lockout_parameters in handlers 2023-05-13 14:04:14 +03:00
Aleksi Häkli
621dfa6882 Fix code formatting 2022-05-16 10:41:07 +03:00
Hasan Ramezani
4da7eb9fc1 Add Optional to type of params with default value equal to None 2022-04-13 17:48:32 +03:00
Antoine Dujardin
9c2ceb7eb7 Add option to keep current behavior for cooloff reset 2022-04-08 22:17:05 +03:00
Antoine Dujardin
1015bad451 Don't reset cooloff time in case of login attempt during lockout 2022-04-08 22:17:05 +03:00
Gregory DAVID
1849552f45 Implement AccessFailureLog recordings 2022-04-08 22:16:19 +03:00
Hasan Ramezani
d674fa6296 Bump prospector from 1.3.1 to 1.5.3 2021-12-08 09:00:51 +01:00
Vasyl Dizhak
8c5c43f482 #750, fix lockout failure when providing AXES_USERNAME_CALLABLE 2021-10-11 20:59:06 +03:00
Yuta Okamoto
46bfc54a03 acquire a lock of AccessAttempt before updating 2021-09-09 17:38:30 +03:00
sarahboyce
403076ef51 feat(helpers): update get_client_str to accept request object
Use case: include more info about the user in the client_str.
username is already included in the arguments but that would require a separate DB call.
https://github.com/jazzband/django-axes/issues/782
2021-09-02 17:40:05 +03:00
Yuta Okamoto
945754eb15 make failures_since_start accessible to the views 2021-08-31 21:24:26 +03:00
Yuta Okamoto
004a0d750c remove failures_since_start from the log 2021-08-31 21:21:28 +03:00
Yuta Okamoto
bd18a531b6 increment failures_since_start in an atomic manner 2021-08-31 21:21:28 +03:00
Aleksi Häkli
ac86d4b213 Adjust commentation and log messages 2021-06-29 17:50:37 +03:00
Uli Klank
f079c48bb1 Restoring necessary general lookup of siilar attempts
Linting
2021-06-29 16:49:12 +03:00
Uli Klank
c72e8e4855 invert condition, warn earlier 2021-06-29 16:49:12 +03:00
Uli Klank
a88366f251 Prevent unnecessary save for created object 2021-06-29 16:49:12 +03:00
Uli Klank
8b5b921b71 Initiallize failures since start correctly 2021-06-29 16:49:12 +03:00
Uli Klank
93341a4d04 Handle race conditions for multiple workers
The creation of several entries is possible due to race conditions between different worker processes, which can later break the usage of get in this situation.
This change should help to prevent this race condition using the database.
2021-06-29 16:49:12 +03:00
Michael O'Connor
170dacc112 Integrate AXS_SENSITIVE_PARAMETERS functionality with AXES_PASSWORD_FORM_FIELD 2021-05-03 17:10:45 +03:00
Michael O'Connor
f54c4f095b Add option to cleanse sensitive GET and POST params in database handler 2021-05-03 17:10:45 +03:00
Aleksi Häkli
b6b26e492f Optimize imports as part of cleanup round 2021-01-07 18:23:33 +02:00
Hasan Ramezani
22c564743d Prevent AccessAttempt creation for None username. 2020-11-05 20:06:49 +02:00
Aleksi Häkli
b569cdb991 Deprecate settings.AXES_LOGGER configuration flag
Fixes #634

The Django import system seems to produce errors
in certain configurations and especially when
MIGRATION_MODULES configuration is set globally.

This is most probably caused by misbehaving or cyclic
Python module imports in the Django application
instrumentatation chain that come up when the
MIGRATION_MODULES configuration is altered.

This patch migrates to the standard Python logging system
use and has less overhead and complexity for users as well.

Having a configurable logging prefix does not produce
a lot of benefits and is less flexible than having
all individual module logging configurations accessible
through the module __name__ parameter in Axes.

For example axes.handlers.* or axes.backends.*
are separately configurable in the new scheme
whereas they would have been both bundled under
the AXES_LOGGER log configuration.
2020-09-26 21:44:56 +03:00
Petr Dlouhý
128d01158c add LOCK_OUT_BY_USER_OR_IP option
store all AccessAttempt records
2020-08-21 17:17:57 +03:00
Jorge Galvis
45109341be Make code Black's compliant. 2020-07-28 20:21:34 +03:00
Jorge Galvis
f772817bc8 Add some docstrings for guidance about creating new handlers. 2020-07-28 20:21:34 +03:00
Jorge Galvis
c786c53e9b Make all handlers to use the AxesBaseHandler mixin. 2020-07-28 20:21:34 +03:00
Jorge Galvis
87d8a974a3 Move signal's callbacks to AxesDatabaseHandler as they only make sense for a DB backend. 2020-07-28 20:21:34 +03:00
Jorge Galvis
9bb04a01b8 Only AxesHandler needs to follow a contract 2020-07-28 20:21:34 +03:00
Jorge Galvis
d6c3663025 Make AxesDatabaseHandler class to be a concrete class of AxesHandler 2020-07-28 20:21:34 +03:00
Aleksi Häkli
344a97c694
Fix code formatting for linter 2020-03-23 13:58:12 +02:00
Damian Dimmich
3d32483dae
Submitting null byte chars causes the user_login_failed code to crash (#578)
Submitting null byte chars like in the post data causes the save to database crash with the following:

/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
ValueError: A string literal cannot contain NUL (0x00) characters.

I propose replacing these to something more palatable to the django ORM, and allowing axes to continue its work and block users with multiple failed login attempts that contain NUL characters.
2020-03-23 13:56:18 +02:00
Aleksi Häkli
34d3b5a1f5
Pluggable user account whitelisting (#549)
Fixes #536
2019-12-29 23:43:55 +02:00
Hasan Ramezani
eb10ecb444 Add comment about caching get_user_attempts output can be dangerous. 2019-12-01 21:33:19 +02:00
Hasan Ramezani
f05ad802e0 Revert "Optimize user attempts fetching. (#491)"
This reverts commit b8ef12ce84.
2019-12-01 21:33:19 +02:00
Hasan Ramezani
0b8bea5d64 Added username to attempts update in AxesDatabaseHandler.user_login_failed(). 2019-11-06 17:19:21 +02:00
Hasan Ramezani
b8ef12ce84 Optimize user attempts fetching. (#491) 2019-11-05 11:12:44 +00:00
Aleksi Häkli
93bb73552e
Upgrade CI tooling to use automatic code formatting 2019-09-28 19:28:17 +03:00
Aleksi Häkli
d8c6632384
Make reset for attempts and logs pluggable
Fixes #454
2019-07-11 15:31:14 +02:00
Aleksi Häkli
4efbace713
Merge #452 into django-axes master
Fixes #451
Fixes #450 merge conflicts
2019-06-14 17:08:07 +03:00
Bo Bayles
dbc0c13029 Allow callable failure limit 2019-06-14 16:48:17 +03:00
Morgan Zolob
71708eff5a Stop showing lockout message when lockout is disabled 2019-06-13 16:29:26 -07:00
Aleksi Häkli
47ae68b0c0 Deprecate AXES_DISABLE_SUCCESS_ACCESS_LOG flag
Fixes #446
2019-05-25 20:45:21 +03:00
Aleksi Häkli
3152b4d7e9 Improve lockout and request handling
The old architecture used exceptions in the signal handler
which prevented transactions from running smoothly
and signal handlers from running after Axes handlers.

The new architecture changes the request approach to request flagging
and moves the exception handling into the middleware call method.

This allows users to more flexibly run their own signal handlers
and optionally use the Axes middleware if they want to do so.

Fixes #440
Fixes #442
2019-05-19 18:32:40 +03:00
Aleksi Häkli
88699cf619
Allow non-Axes requests in the handler backends 2019-05-08 13:28:22 +03:00
Aleksi Häkli
430946a9d1 Rename AxesBaseHandler to AxesHandler 2019-04-27 18:51:02 +03:00
Aleksi Häkli
e24f0453bb
Remove reduntant AccessLog.trusted flag
All attempts that are logged are marked as trusted
and no other attempts are created in the code,
so having a flag that also uses a database index
is redundant and unnecessary.

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-03-13 16:07:25 +02:00
Aleksi Häkli
3bece1aaaa
Set Axes request attributes in middleware
Fixes #415

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-03-03 22:13:13 +02:00