Repository navigation
enterprise: add required actions for users - #24846
Conversation
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
f5975c1 to
4447fbd
Compare
17e1f32 to
caedd92
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24846 +/- ##
==========================================
+ Coverage 92.48% 92.73% +0.25%
==========================================
Files 1197 1204 +7
Lines 81116 82371 +1255
Branches 4497 4686 +189
==========================================
+ Hits 75017 76388 +1371
+ Misses 6033 5907 -126
- Partials 66 76 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
6110a14 to
b0cf6c6
Compare
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-304644d8f514906f68508fbcce9df734450f2b61
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-304644d8f514906f68508fbcce9df734450f2b61Afterwards, run the upgrade commands from the latest release notes. |
979edcc to
400e27c
Compare
dominic-r
left a comment
There was a problem hiding this comment.
q for myself: what if starts oidc flow, what happens to your next action
BeryJu
left a comment
There was a problem hiding this comment.
I'm not the biggest fan of splicing flows together, I think I kinda prefer what the source stage does with suspending/pausing one flow and running another
Aside from that, don't like the naming (not a big issue)
Also the other thing I'd like to be able to do with a system like this is to "require" them to go through a flow, even if they have a session that's already authenticated. In theory you could use this and just revoke their sessions, but imo it would be cleaner to just click a button on user x forcing them to change their password/re-enroll MFA/etc and the next request they send would cause them to be in that flow and not be able to do anything else
Review asked for three changes: pause and resume flows the way the Source stage does instead of splicing a completion stage into other flows, apply actions to sessions that already exist, and a clearer name. The middleware now reads goauthentik.io/user/required-actions on every authenticated request, so an action added to a logged-in user applies on their next request and the User Login stage needs no hook. Starting an action suspends what the user was doing: a flow in progress is kept on the action's completion stage and restored afterwards, and any other page is opened again. The Redirect stage hook is gone, so an action flow can no longer hand off to another flow. The set and removed events are dropped because the user's model_updated event already records the attribute change. Validation only runs when the value changes, so a deleted flow doesn't block unrelated edits.
Reject flows that a logged-in user can never plan, such as the unauthenticated recovery and enrollment flows, which would otherwise lock the user out. Keep the body of a suspended POST in the session, as the login redirect does, so a SAML POST binding still works once the actions are done. Complete the action for the plan's pending user, so a plan restored in another browser from an email link doesn't fail.
kensternberg-authentik
left a comment
There was a problem hiding this comment.
Wow. One front-end line. :-).
Otherwise an Email stage can fail with "No pending user." and leave the user stuck.
|
Is this going to be Enterprise-only? The part about the restriction staying active after an Enterprise license expires reads that way, though I might be misreading it. If it is, I think it's the wrong call. Forcing a user to complete something before they can get in, like enrolling MFA or changing a password, isn't an advanced feature. It's the basic mechanism you need to roll MFA out to accounts that already exist. Keycloak has had the same thing in the free version for years, they call it required actions. Related question while you're here: would next actions cover the Active Directory case where an account is flagged "user must change password at next logon"? With an LDAP source the bind comes back with error 773 and pwdLastSet is 0, and I haven't found a way to turn that into a forced password change at login. Keycloak maps it to its update password action automatically. If next actions is where that would end up living, that's one more reason not to put it behind a license. For self-hosted setups this is the difference between being able to enforce MFA and not being able to. Security controls that sit behind a license are the ones that end up never getting turned on. I get that the project needs money and I'd happily pay for support, but this isn't the thing to charge for. |
Details
What does this PR change?
Adds required actions, an Enterprise feature. A user's
goauthentik.io/user/required-actionsattribute lists flows they must complete before they can use authentik. On their next request, including in a session that's already logged in, authentik pauses what they were doing and runs each flow in order. Afterwards, it resumes the page or flow they were in. Each completed flow is removed from the attribute and logged as a Required action completed event.Following review, the User Login and Redirect stages are untouched. A flow in progress is suspended on the action's completion stage and restored afterwards, the way the Source stage does it, rather than having stages spliced into other flows. The feature is renamed from "next actions" now that it isn't tied to login.
Why is this change needed?
Admins can't make a user change their password or set up an authenticator without building their own flows and policies.
How was this tested?
Tests cover login, an existing session, a flow suspended mid-way and resumed, a resumed POST, several and replaced actions, invalid actions failing closed, license states, impersonation, and what a restricted session can reach.
I also ran the stack locally with license validation stubbed the way the tests do it. I added
default-password-changeto a user from the admin card in #24850 and logged in as that user. authentik sent them to the password change instead of the user interface, and after they changed it they landed on the user interface with the action cleared and the event recorded.Linked issues
closes #19681
closes #25310
Screenshots
The user is sent to their required action:
The admin card from #24850:
The new event:
Checklist
make all)make docs)