end-session with an unfinished flow leads to blank page
Describe the bug
Since 2026.8.0, the OIDC end-session endpoint (/application/o/<slug>/end-session/) returns an empty 200 OK whenever the browser's session already holds a flow plan, even one for an unrelated flow. It never plans the provider's invalidation flow. The user lands on a blank page instead of the "You've logged out of " screen, and neither the RP's post_logout_redirect_uri nor the invalidation flow runs.
The cause is the early return added in #23919 (d2c63ecbf7) in EndSessionView.dispatch:
def dispatch(self, request, *args, **kwargs):
if SESSION_KEY_PLAN in request.session:
return HttpResponse(status=200)
return super().dispatch(request, *args, **kwargs)This is meant for front-channel logout iframes that call end-session while an invalidation flow is running. But SESSION_KEY_PLAN is set for any unfinished flow, and ordinary use leaves plans in the session all the time:
- The user settings page.
ak-user-settings-flow-executorGETs the user-settings flow executor infirstUpdated. That plan stays in the session until the user submits the form, which they usually don't. - The session-end screen itself.
SessionEndStageis the last stage of the invalidation plan, and its options are plain links, so nothing is ever posted back to it. After one RP-initiated logout, the plan stays in the session and blanks the next logout from any other app. - Any other abandoned flow, such as an authenticator setup flow started and not finished, or a login page left open.
It looks intermittent to users because it depends on what they did earlier in the session.
How to reproduce
A. User settings (stock UI only):
- Sign in to authentik, and to an OIDC application through it.
- Open the user interface → Settings (the user-settings flow form loads). Don't submit it.
- Trigger RP-initiated logout from the application, or open
https://<authentik>/application/o/<slug>/end-session/directly. - The response is
200with an empty body, and the page is blank.
B. Two logouts in a row:
- Sign in to two OIDC applications, A and B, through authentik (SSO).
- Log out of A through its end-session endpoint. The session-end screen appears as expected. Leave it using any of its links.
- Log out of B through its end-session endpoint.
- The response is
200with an empty body.
In both cases, requesting /flows/-/cancel/ before step 3 makes the logout work normally.
Expected behavior
End-session should plan and run the provider's invalidation flow: the session-end screen, or a redirect to a valid post_logout_redirect_uri. A leftover plan for an unrelated flow shouldn't turn logout into a no-op.
The short-circuit should only apply to the case it was added for, when the stored plan is an invalidation flow that's still running (the front-channel iframe case). Possible ways to narrow the check:
- Only return early if the stored plan's flow has
designation == invalidation. - Or only if the stored plan still has pending iframe-logout or session-end stages.
- Otherwise, discard the stale plan and continue as before.
FlowExecutorViewalready does this when it finds a plan for a different flow ("Found existing plan for other flow, deleting plan").
Screenshots
No response
Additional context
Regressed in #23919 ("providers/oauth2: fix iframe logout stage progression").
Deployment Method
Kubernetes
Version
2026.8.3
Relevant log output
N/ASource: goauthentik/authentik