outpost/proxyv2: revalidate auth if session fails to load#18063
Merged
dewi-tik merged 1 commit intogoauthentik:mainfrom Feb 5, 2026
Merged
outpost/proxyv2: revalidate auth if session fails to load#18063dewi-tik merged 1 commit intogoauthentik:mainfrom
dewi-tik merged 1 commit intogoauthentik:mainfrom
Conversation
✅ Deploy Preview for authentik-docs canceled.
|
✅ Deploy Preview for authentik-integrations canceled.
|
✅ Deploy Preview for authentik-storybook canceled.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18063 +/- ##
==========================================
- Coverage 93.24% 93.23% -0.01%
==========================================
Files 968 968
Lines 53331 53331
==========================================
- Hits 49726 49722 -4
- Misses 3605 3609 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
dominic-r
reviewed
Nov 13, 2025
e161e40 to
cb47b17
Compare
Contributor
|
Closes #19740 |
dominic-r
approved these changes
Jan 29, 2026
cb47b17 to
91e2829
Compare
Contributor
Author
|
Rebased/resolved conflict |
BeryJu
approved these changes
Feb 5, 2026
Contributor
|
🍒 Cherry-pick to |
Contributor
|
🍒 Cherry-pick to |
Contributor
|
Thanks for this @chetan ! |
BeryJu
pushed a commit
that referenced
this pull request
Feb 5, 2026
BeryJu
pushed a commit
that referenced
this pull request
Feb 5, 2026
atereshkin
pushed a commit
to atereshkin/authentik
that referenced
this pull request
Feb 9, 2026
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.
Bug
The forward auth handler in the outpost does not properly handle a session load failure. When the session fails to load, it simply bails out, returning a
200to the reverse proxy which then allows the request to proceed. Depending on the configuration of the upstream service, this can result in a 401, basic auth prompt, or simply allowing access. With one of my applications, the app set it's own cookies which still granted access despite the invalid authentik session.Similar issue is mentioned in #2023 (comment)
Setup:
Flow:
{"event":"Logging out","level":"debug","logger":"authentik.outpost.proxyv2","provider":"app.example.com","timestamp":"2025-11-10T17:22:54Z"} {"event":"deleting session","level":"trace","logger":"authentik.outpost.proxyv2.application","name":"provider-app","path":"/dev/shm/session_6JCRTWRRAVWIPWGLBIWZZPLTYUI27PYAVIEQKH5YSDQOMBNMMIWA","timestamp":"2025-11-10T17:22:54Z"}200- app returns 401Step 2 can also be a restart of the outpost due to crash, reboot, or redeployment.
Fix
After session validation falls through, fix the session/state setup so we can redirect to the auth server and complete the flow. User will either be prompted to log in or, if they had already logged back in again, they will be sent back and the new session will be established properly.