Skip to content
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

stages/authenticator_validate: remember #2828

Merged
merged 12 commits into from May 10, 2022
Merged

Conversation

BeryJu
Copy link
Member

@BeryJu BeryJu commented May 8, 2022

Add option only validate MFA when device has not been used in x time

BeryJu added 2 commits May 8, 2022 22:08
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
@codecov
Copy link

codecov bot commented May 8, 2022

Codecov Report

Merging #2828 (d7f5b8d) into master (4d755dc) will increase coverage by 0.06%.
The diff coverage is 99.53%.

@@            Coverage Diff             @@
##           master    #2828      +/-   ##
==========================================
+ Coverage   91.76%   91.81%   +0.06%     
==========================================
  Files         455      459       +4     
  Lines       20040    20196     +156     
==========================================
+ Hits        18387    18541     +154     
- Misses       1653     1655       +2     
Impacted Files Coverage Δ
authentik/flows/tests/test_executor.py 100.00% <ø> (ø)
authentik/policies/password/tests/test_flows.py 100.00% <ø> (ø)
authentik/stages/authenticator_validate/api.py 100.00% <ø> (ø)
authentik/stages/deny/tests.py 100.00% <ø> (ø)
authentik/stages/identification/tests.py 100.00% <ø> (ø)
authentik/stages/invitation/tests.py 100.00% <ø> (ø)
authentik/stages/password/tests.py 100.00% <ø> (ø)
authentik/stages/user_delete/tests.py 100.00% <ø> (ø)
authentik/stages/user_login/tests.py 100.00% <ø> (ø)
authentik/stages/user_write/tests.py 100.00% <ø> (ø)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d755dc...d7f5b8d. Read the comment docs.

BeryJu added 8 commits May 9, 2022 11:54
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
@netlify
Copy link

netlify bot commented May 10, 2022

Deploy Preview for authentik ready!

Name Link
🔨 Latest commit d7f5b8d
🔍 Latest deploy log https://app.netlify.com/sites/authentik/deploys/627ab0baed7155000860f669
😎 Deploy Preview https://deploy-preview-2828--authentik.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
@BeryJu BeryJu merged commit fd1d38f into master May 10, 2022
@BeryJu BeryJu deleted the stages/validate/2fa-remember branch May 10, 2022 19:05
BeryJu added a commit that referenced this pull request May 23, 2022
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
BeryJu added a commit that referenced this pull request May 23, 2022
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
@Matchlighter
Copy link

Matchlighter commented May 27, 2022

@BeryJu It looks like the last 2FA verification timestamp is being stored in the DB (as the last_t column)? It should be stored in the/a cookie so that it is scoped to a single client/browser. Otherwise it creates a security implication that if the true user logs in and completes MFA, a malicious device has an opportunity to login as that user without being impeded by 2FA. Am I seeing things right or did I miss something?

@BeryJu
Copy link
Member Author

BeryJu commented May 27, 2022

@Matchlighter you raise a good point, it would have to be stored in a separate, signed/encrypted cookie that lasts longer than the session (maybe no expiry at all?), but yes, the way you've described it is what would currently happen. I'll add a note to the docs to make this clear to people configuring it, since the above solution is not an easy fix

@BeryJu
Copy link
Member Author

BeryJu commented May 27, 2022

Actually we could set a cookie with an expiry of the configure threshold in the stage, save which device the user used to authenticate that session and then simply check for it's existence (and check the device belongs to the current user and the current stage, etc), but that should be pretty simple

@Matchlighter
Copy link

T'would need to have the expiration baked in to the signed-part of the cookie (and not just rely on a browser mechanism that could be circumvented if the cookie was stolen) (which could all be a given with Django - it's been a while for me).

@BeryJu
Copy link
Member Author

BeryJu commented May 27, 2022

Yeah true the expiration would also be saved in the cookie, or alternatively the timestamp of when the verification was done, which would make changing of the threshold easier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants