Repository navigation
Conversation
When a login_hint is passed to the OAuth2 authorize endpoint, it is prefilled into the identification stage and also carried in the flow's `next` param. On clicking 'Not You?', CancelView redirected back to `next`, which re-entered the authorize flow and re-applied login_hint from the URL, trapping the user in a loop. Strip login_hint from the cancel `next` redirect so re-entering the flow no longer re-prefills the identifier, while legitimate first-arrival prefill (read directly from the authorize URL) is unaffected. Fixes goauthentik#25476
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Jens Langhammer <[email protected]>
BeryJu
approved these changes
Sep 14, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26111 +/- ##
==========================================
- Coverage 91.89% 91.86% -0.03%
==========================================
Files 1171 1171
Lines 75653 75679 +26
Branches 4056 4056
==========================================
+ Hits 69521 69524 +3
- Misses 6090 6113 +23
Partials 42 42
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
| if next_url and not is_url_absolute(next_url): | ||
| return redirect(next_url) | ||
| # Ensure that we get rid of any user identifiers from the URL | ||
| return redirect(self.clean_next_url(next_url)) |
Contributor
|
🍒 Cherry-pick to |
BeryJu
added a commit
that referenced
this pull request
Sep 15, 2026
…ick #26111 to version-2026.8) (#26168) flows: strip login_hint from next on cancel to prevent loop (#26111) * flows: clear login_hint on cancel to fix 'Not You?' loop When a login_hint is passed to the OAuth2 authorize endpoint, it is prefilled into the identification stage and also carried in the flow's `next` param. On clicking 'Not You?', CancelView redirected back to `next`, which re-entered the authorize flow and re-applied login_hint from the URL, trapping the user in a loop. Strip login_hint from the cancel `next` redirect so re-entering the flow no longer re-prefills the identifier, while legitimate first-arrival prefill (read directly from the authorize URL) is unaffected. Fixes #25476 * cleanup --------- Signed-off-by: Jens Langhammer <[email protected]> Co-authored-by: Jorge Polanco <[email protected]> Co-authored-by: Jens Langhammer <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #25476.
login_hintrides along in thenextparam, so hitting "Not You?" just re-prefills the same email and reloads — an infinite loop.The chain: authorize redirects to the flow with
next=<authorize URL incl. login_hint>; the identification stage prefills from it (correct on first arrival); but "Not You?" points at the cancel URL whosenextstill carrieslogin_hint, soCancelViewredirects straight back into authorize and re-prefills.CancelViewis the single point where the user expresses "change identity", and every provider'snextroutes through it — so that's the minimal root-cause fix: strip onlylogin_hintfrom thenextURL there (preservingclient_id,state, etc.). The legitimate first-arrival prefill is untouched.Tests:
test_cancel_strips_login_hint(login_hint gone after cancel, other params kept) andtest_cancel_preserves_next_without_login_hint; both fail without the fix. The existingtest_login_hint(first-arrival prefill) still passes.ruffis clean.Note: I couldn't run the full pytest suite locally (needs the multi-tenant Postgres + xmlsec1 setup) — a CI run would be good to confirm.
Disclosure: I use AI assistance for code review and for drafting text; I review and verify every change myself.