-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for django-hijack #13
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 13 +3
Lines 195 226 +31
Branches 22 27 +5
=========================================
+ Hits 195 226 +31 ☔ View full report in Codecov by Sentry. |
Thanks to @Bartvaderkin for the original implementation Added signals so that hijacking admin users works without entering their second factor by (OTP) logging them in with a temporary device. Special care is taken to ensure hijacking is only allowed for users that are verified, even if you forget to specify a custom permission check. This functionality explicitly tests that it cannot be abused to circumvent multi-factor authentication.
This also requires the user to be verified so the hijack stops before the view fully executes, rather than crashing in the signal receiver.
cc591ad
to
5737be2
Compare
|
||
|
||
@pytest.fixture | ||
def mfa_admin_user(admin_user): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is admin_user
a pytest-django specific fixture?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something that also should be taken into account in the upstream django two factor auth library? Or is it really specific to MM?
Really specific to our particular combination of django-2fa and django-hijack. Of course, users of django-two-factor-auth can always use this library as a source of inspiration :D |
Closes #9