Skip to content

stages/authenticator_validate: prevent WebAuthn challenge races - #26291

Merged
GirlBossRush merged 3 commits into
goauthentik:mainfrom
ryanpesek:fix/webauthn-stale-challenge
Nov 6, 2026
Merged

GirlBossRush merged 3 commits into
goauthentik:mainfrom
ryanpesek:fix/webauthn-stale-challenge

Conversation

@ryanpesek

@ryanpesek ryanpesek commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Details

This PR keeps the pending WebAuthn challenge stable until it's answered. Closes #26986; complements #27395 and #25212.

  • Reuse the pending challenge when the authenticator validation stage renders again
  • Remove it once validated, skipped, enrolled, or passed by identification
  • Only send the selection request for SMS and email

Checklist

  • The project has been linted, built, and tested (make all)
  • The documentation has been updated and formatted (make docs)
  • I have read the AI usage policy.

@ryanpesek
ryanpesek requested review from a team as code owners September 21, 2026 01:57
@netlify

netlify Bot commented Sep 21, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit b81b92b
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6ab08f06df856300089665c8
😎 Deploy Preview https://deploy-preview-26291--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.

@ryanpesek

ryanpesek commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Related work: #22369 addresses the other half of the authenticator-validation issues found during this investigation. This PR is intentionally focused on concurrency and session races that can replace a pending WebAuthn challenge or overwrite flow progress. #22369 provides the broader validation-stage refactor, including server-side challenge lookup, per-device challenge lifecycles, prevention of cross-device-type response validation, and preventing WebAuthn stage loads or re-renders from decrementing the user reputation score. Once both are merged, they cover the race conditions and the validation-model and reputation issues independently.

@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.01%. Comparing base (3bbf713) to head (09eabdd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26291      +/-   ##
==========================================
+ Coverage   92.96%   93.01%   +0.04%     
==========================================
  Files        1230     1230              
  Lines       85916    85989      +73     
  Branches     4894     4894              
==========================================
+ Hits        79874    79979     +105     
+ Misses       5955     5923      -32     
  Partials       87       87              
Flag Coverage Δ
conformance 30.37% <5.19%> (-0.03%) ⬇️
e2e 35.06% <9.09%> (+0.28%) ⬆️
integration 27.55% <3.89%> (-0.34%) ⬇️
rust 51.12% <ø> (ø)
unit 94.56% <100.00%> (+0.01%) ⬆️
unit-migrate 94.57% <100.00%> (+0.01%) ⬆️

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.

@netlify

netlify Bot commented Oct 2, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit ddbdb8f
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6abf1164185e5400088c93cb
😎 Deploy Preview https://deploy-preview-26291--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 Oct 2, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit ddbdb8f
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6abf11648beded0008344f9c
😎 Deploy Preview https://deploy-preview-26291--authentik-storybook.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.

@BeryJu BeryJu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

approve for backend

@BeryJu BeryJu added this to the Release 2026.11.0 milestone Oct 30, 2026
@GirlBossRush
GirlBossRush force-pushed the fix/webauthn-stale-challenge branch from ddbdb8f to 657379e Compare November 5, 2026 19:10
ryanpesek and others added 2 commits November 6, 2026 00:43
…til it's answered

Rendering the stage again, from another tab or a selection request, replaced the
challenge an in-progress assertion was signed for. Reuse it instead, and remove
it once validated, skipped, enrolled, or passed by identification.

Co-authored-by: Jens Langhammer <[email protected]>
Selecting any other device has no effect on the server, but the request still
re-renders the stage and races the actual response.
@GirlBossRush
GirlBossRush force-pushed the fix/webauthn-stale-challenge branch from 657379e to 485f964 Compare November 6, 2026 00:43
@GirlBossRush
GirlBossRush merged commit eb3832a into goauthentik:main Nov 6, 2026
162 of 163 checks passed
kensternberg-authentik added a commit that referenced this pull request Nov 6, 2026
* main:
  website/docs: dry run: move :ak-version to header (#27678)
  web: policy dry run UI (#26621)
  providers/oauth2: fix max_age=0 not forcing reauth (#27518)
  ci: bump pnpm/action-setup from 6.1.0 to 6.1.1 (#27666)
  core: bump oauthlib from 4.0.0 to 4.0.1 (#27658)
  core: bump psycopg[c,pool] from 3.3.6 to 3.3.7 (#27672)
  core: bump selenium from 4.51.0 to 4.52.0 (#27670)
  ci: bump helm/kind-action from 1.15.1 to 1.15.2 (#27667)
  ci: bump pnpm/action-setup from 6.1.0 to 6.1.1 in /.github/actions/setup (#27668)
  ci: bump the codeql group across 1 directory with 3 updates (#27665)
  ci: bump taiki-e/install-action from 2.89.1 to 2.90.0 in /.github/actions/setup (#27669)
  core: bump goauthentik/fips-python from `69e7058` to `b203e83` in /lifecycle/container (#27664)
  core: bump openapitools/openapi-generator-cli from v7.26.0 to v7.27.0 in /packages/client-go (#27661)
  stages/authenticator_validate: prevent WebAuthn challenge races (#26291)
  web/i18n: load the locale catalog before boot and remove msg() thunks (#27618)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebAuthn authenticator validate always fails with 'Client data challenge was not expected challenge' on 2026.8.4 (split-screen flow, Bitwarden passkey)

3 participants