Skip to content

web/flows: fix race condition in continuous login and support source stages in authentication flows (cherry-pick #23049 to version-2026.2) - #23557

Merged
gergosimonyi merged 1 commit into
version-2026.2from
cherry-pick/23049-to-version-2026.2
Jul 3, 2026
Merged

gergosimonyi merged 1 commit into
version-2026.2from
cherry-pick/23049-to-version-2026.2

Conversation

@GirlBossRush

@GirlBossRush GirlBossRush commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

This PR is a backport of #23049 to version-2026.2, rebuilt from the merged commit on main (42960643) rather than the earlier PR revision the previous backport branch used in #23060

Adaptations for version-2026.2

  • version-2026.2 lacks the flow controllers refactor (web/flow: extract lifecycle events peripheral to stage management into their own controllers #20898), so FlowMultitabController's logic is ported inline into FlowExecutor's ak-multitab-continue listener. It uses the merged design's same-origin suppress/leave logic for next (the SP-initiated SAML resume fix) but keeps the blank://blank app-hiding guard, which 2026.2 still relies on (the dashboard-hide option only landed in 2026.5).
  • The multi-tab files (broadcast.ts, orchestrator.ts, TabID.ts, new events.ts/messages.ts) are identical to main.
  • RedirectStage.ts carries only the web/flows: fix race condition in continuous login and support source stages in authentication flows #23049 changes (final_redirect handling), without unrelated main drift.
  • test_auth_n_request.py setUp creates the test-app Application (already present on main).
  • Generated API clients (go/rust/ts) come from schema.yml at release time; 2026.2 tracks none of them, so only the schema contract is committed.

@GirlBossRush
GirlBossRush requested review from a team as code owners June 30, 2026 17:49
@netlify

netlify Bot commented Jun 30, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit dbefdc7
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a4401be60739300083aeed7
😎 Deploy Preview https://deploy-preview-23557--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jun 30, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit dbefdc7
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a4401be7ef4dc00084ff08b
😎 Deploy Preview https://deploy-preview-23557--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

…stages in authentication flows (cherry-pick #23049 to version-2026.2)

Backport of #23049, rebuilt from the final merged state on main
(4296064) rather than the early PR revision the previous attempt was
based on.

Adaptations for version-2026.2:
- FlowMultitabController logic ported inline into FlowExecutor's
  ak-multitab-continue listener (2026.2 lacks the controllers refactor),
  keeping the blank://blank app-hiding guard still used in 2026.2.
- test_auth_n_request setUp creates the test-app Application (main
  already had it).
- Generated API clients are produced from schema.yml at release time;
  only the schema contract is committed (2026.2 tracks no client-*).

Co-Authored-By: Playpen Agent <[email protected]>
@GirlBossRush
GirlBossRush force-pushed the cherry-pick/23049-to-version-2026.2 branch from dbefdc7 to f24f1df Compare June 30, 2026 17:54
@codecov

codecov Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.47%. Comparing base (c7d515b) to head (f24f1df).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                Coverage Diff                 @@
##           version-2026.2   #23557      +/-   ##
==================================================
+ Coverage           93.45%   93.47%   +0.01%     
==================================================
  Files                 985      985              
  Lines               55900    55956      +56     
==================================================
+ Hits                52242    52304      +62     
+ Misses               3658     3652       -6     
Flag Coverage Δ
conformance 36.91% <11.47%> (-0.03%) ⬇️
e2e 42.64% <14.75%> (-0.03%) ⬇️
integration 22.02% <4.91%> (-0.02%) ⬇️
unit 91.80% <98.36%> (+0.08%) ⬆️
unit-migrate 91.82% <98.36%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-f24f1df8a7419326591792d1f51ccdf9b0eb8225
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

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-f24f1df8a7419326591792d1f51ccdf9b0eb8225

Afterwards, run the upgrade commands from the latest release notes.

@GirlBossRush
GirlBossRush requested a review from gergosimonyi July 1, 2026 01:22

@kensternberg-authentik kensternberg-authentik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed feelings... This seems esoteric enough that I have trouble following along, but the basic code makes sense. The window seems a little small (20ms) for something that's looking for multiple tabs; in a heavily-loaded system (like my little toy Surface 1), chrome can bog down badly and getting a response back in that short a period seems unlikely.

Also, there's a for/await loop here that's gathering information from a bunch of tabs; the order doesn't seem to matter, so why isn't this "launch a bunch of promises and gather them with allSettled()?" If they're loaded tabs, the user could be waiting on a frozen screen as each one runs or times out (15 seconds each!).

I'm not going to block approval; this is a fair backport. I just want it to be one that doesn't generate service calls.

this.dispatchMessage({
type: BroadcastMessageType.Discover,
sender: TabID.shared.current,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Immediately after this is a delay of 20ms to await the transfer of discovered Tabs. If a tab is busy in its main thread, it could easily miss this window. Is 20ms really long enough?

Broadcast.shared.resumeTab(tab, resumeID);

await done.promise;
await done;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, dumb question. for loops with an await are a code smell. Why isn't this an array fed to Promise.allSettled()? You're waiting on a per tab basis, serially, sequentially. That seems... wrong, somehow. Maybe I don't understand the problem.

@github-project-automation github-project-automation Bot moved this from In review to In Progress in authentik Core Jul 3, 2026
@gergosimonyi
gergosimonyi merged commit 79ea29c into version-2026.2 Jul 3, 2026
94 checks passed
@gergosimonyi
gergosimonyi deleted the cherry-pick/23049-to-version-2026.2 branch July 3, 2026 03:17
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend area:frontend Features or issues related to the browser, TypeScript, Node.js, etc

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants