web: Fix duplicate Turnstile widgets after extended idle#21380
web: Fix duplicate Turnstile widgets after extended idle#21380GirlBossRush wants to merge 1 commit intomainfrom
Conversation
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21380 +/- ##
==========================================
- Coverage 92.47% 92.46% -0.01%
==========================================
Files 1013 1013
Lines 58165 58165
Branches 1494 1494
==========================================
- Hits 53788 53785 -3
- Misses 4337 4340 +3
Partials 40 40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
b5d4ee2 to
d129376
Compare
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-d129376a7c7d77535f917d95441b204efa03cb70
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-d129376a7c7d77535f917d95441b204efa03cb70Afterwards, run the upgrade commands from the latest release notes. |
Details
Turnstile's client-side script includes a self-upgrade mechanism that periodically replaces its own
<script>tag with a fresh version. When the upgraded script loads, it restores its internal widget state and then re-scans the DOM for.cf-turnstileelements to implicitly render — even though those containers already have an active widget. This results in duplicate widgets accumulating over time.This PR changes our Turnstile controller from implicit rendering (via the cf-turnstile class and data-* attributes), to explicit rendering (
?render=expliciton the script URL + a manualturnstile.render()call). With explicit mode, the self-upgrade cycle no longer triggers a DOM scan, so existing widgets aren't duplicated.Closes #18156