Repository navigation
core: keep the current login when adding a user after a stale session save - #26765
Conversation
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #26765 +/- ##
=======================================
Coverage 92.42% 92.42%
=======================================
Files 1179 1179
Lines 78482 78551 +69
Branches 4129 4129
=======================================
+ Hits 72534 72604 +70
+ Misses 5882 5881 -1
Partials 66 66
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Playwright e2eDownload this run's HTML report and traces, then open the report: gh run download 37826324496 -D playwright-artifacts
npx playwright show-report playwright-artifacts/playwright-reportInstallation instructionsInstructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-1b69499579761331e1362479dcd0059bdda2bd4e
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-1b69499579761331e1362479dcd0059bdda2bd4eAfterwards, run the upgrade commands from the latest release notes. |
… save The add-user marker lives in the session's flow plan. A concurrent request that saved an older copy of the session could drop it, so the login stage treated the new login as a plain one and login() deleted the previous user's session. When the brand has a user switch flow, logging in as another user now always keeps the current login as a switch target.
61361f7 to
7b056a4
Compare
…uests (#26790) * stages/user_login: only keep the current login for explicit user switches Treating every login on a brand with user switching as an add-user login changed what signing in as someone else means and skipped the internal-user check for added accounts. The plan losing its marker is fixed at its cause instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> * core: extend session expiry from users/me without rewriting session data users/me marked the whole session modified to slide its expiry, so it saved the session data it loaded at the start of the request. A request that saved the session in the meantime, like starting "Add another user", lost its changes, and the flow then logged in without the add-user marker and signed out the first account. Co-Authored-By: Claude Opus 5.5 <[email protected]> * core: pin that a plain login replaces the session with user switching enabled Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
authentik's SessionStore is the only session engine, so the getattr fallback never applies. It only hid that save_expiry() right below is called without one. Co-authored-by: Claude Opus 5.5 <[email protected]>
The binding middleware set LAST_IP as a session key, which marked the session as modified. The full save at the end of the request then wrote back the session data loaded at its start, erasing anything a concurrent request saved in the meantime, like the user switching flow plan. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* main: (86 commits) ci: switch version bump to action, like platform repo (#26949) core, web: update translations (#26940) ci: bump actions/create-github-app-token from 3.2.0 to 3.3.0 (#26946) ci: bump taiki-e/install-action from 2.87.27 to 2.87.28 in /.github/actions/setup (#26947) core: bump hyper-unix-socket from 0.6.1 to 0.7.0 (#26945) core: bump goauthentik/selenium from 152.0-ak-0.71.0 to 152.0-ak-0.72.0 in /tests/e2e (#26943) core: bump goauthentik/platform-ssh from 26.04-ak-0.71.0 to 26.04-ak-0.72.0 in /tests/e2e (#26944) core: keep the current login when adding a user after a stale session save (#26765) flows: fix blip of un-templated flow title placeholder (#26905) website/docs: Version 2026.8.4 Release Notes (cherry-pick #26934 to main) (#26939) core: bump rust-toolchain from 1.98.1 to 1.99.0 (#26634) stages/authenticator_validate: enforce code device restrictions (#26779) website/docs: Expand docs on aws installation (#26812) web: Add alert when JavaScript is disabled. (#26921) website: remove the docs glossary (#26930) core: bump axllent/mailpit from v1.31.4 to v1.31.5 in /tests/e2e (#26907) core: bump astral-sh/uv from 0.13.0 to 0.13.1 in /lifecycle/container (#26909) core: bump serde_json from 1.0.151 to 1.0.154 (#26911) core: bump the types group with 2 updates (#26912) core: bump aws-lc-rs from 1.18.1 to 1.18.2 (#26913) ...
* main: (144 commits) ci: switch version bump to action, like platform repo (#26949) core, web: update translations (#26940) ci: bump actions/create-github-app-token from 3.2.0 to 3.3.0 (#26946) ci: bump taiki-e/install-action from 2.87.27 to 2.87.28 in /.github/actions/setup (#26947) core: bump hyper-unix-socket from 0.6.1 to 0.7.0 (#26945) core: bump goauthentik/selenium from 152.0-ak-0.71.0 to 152.0-ak-0.72.0 in /tests/e2e (#26943) core: bump goauthentik/platform-ssh from 26.04-ak-0.71.0 to 26.04-ak-0.72.0 in /tests/e2e (#26944) core: keep the current login when adding a user after a stale session save (#26765) flows: fix blip of un-templated flow title placeholder (#26905) website/docs: Version 2026.8.4 Release Notes (cherry-pick #26934 to main) (#26939) core: bump rust-toolchain from 1.98.1 to 1.99.0 (#26634) stages/authenticator_validate: enforce code device restrictions (#26779) website/docs: Expand docs on aws installation (#26812) web: Add alert when JavaScript is disabled. (#26921) website: remove the docs glossary (#26930) core: bump axllent/mailpit from v1.31.4 to v1.31.5 in /tests/e2e (#26907) core: bump astral-sh/uv from 0.13.0 to 0.13.1 in /lifecycle/container (#26909) core: bump serde_json from 1.0.151 to 1.0.154 (#26911) core: bump the types group with 2 updates (#26912) core: bump aws-lc-rs from 1.18.1 to 1.18.2 (#26913) ...
Details
This PR prevents "Add another user" from signing out the first account. I encountered this while testing the Playwright
102-user-switchingtest where it'd failed intermittently (1 in 3–8 runs). This change appears to eliminate the flakiness.login()deleted the first user's session.users/memarked the session as modified on every call to extend its expiry, so the middleware wrote the whole session back, including the stale copy of the flow plan it loaded at the start of the request. It now saves onlyexpiresandlast_used.last_ipas a session key, which caused the same full write-back. It now updates only thelast_ipcolumn.test_plain_login_replaces_session_with_switching_enabledcovers that.