Repository navigation
Description
Summary
The production Turnstile widget (site key 0x4AAAAAAEFpp8n3BBZfG0KF, "wemeditate.com +1 (Spin)") only allows the hostnames sahajatlas.com, wemeditate.com, localhost, 127.0.0.1 and, since the stop-gap, shrimataji.org. The script embed renders Turnstile inside the host's page, and Turnstile validates that page's hostname. So every registration and issue report on any other partner site using the script embed fails its captcha with error 110200 (unknown domain), and the visitor sees the captcha-blocked screen. Iframe embeds are not affected, because there the challenge renders on sahajatlas.com.
Approach
Render the challenge in a small frame served from the widget's own origin, so Turnstile always sees sahajatlas.com, whatever page hosts the widget. One widget, one hostname list, no per-partner step, no SahajCloud change.
- Challenge page. Add a static page on the widget origin (e.g.
challenge.html, a Vite input beside the others atvite.config.ts:309) that loadsapi.js?render=explicit, renders the production site key with thethemeandlanguageit is given on its query string, andpostMessages to its parent:token(with the value),expired,error, and areadyhandshake oncewindow.turnstileexists. It accepts aresetmessage back. The token is single-use and obtainable by anyone who frames the page, so'*'as the target origin leaks nothing new. useTurnstile(src/hooks/use-turnstile.ts:145): keep its public shape (challengeRef,token,status,reset) soRegistrationFormandReportIssueFormdo not change. Replace the script load andturnstile.render(:53,:182) with an<iframe>(≈300×65,border: 0,title,referrerpolicy="strict-origin") appended tochallengeRef, its URL resolved againstimport.meta.urlassrc/styles/fonts.ts:121does, so previews and localhost frame their own origin. Accept only messages whoseevent.sourceis that frame'scontentWindowand whoseevent.originis the frame's origin.reset(:225) postsresetinstead of callingturnstile.reset. Keep the existing semantics:blockedis not a latch, a latertokenwins the form back, and the frame is removed on unmount.probeTurnstile/useTurnstileGuard(src/hooks/use-turnstile.ts:101,src/hooks/use-turnstile-guard.ts:44): the probe mounts a hidden frame and resolvestrueon itsreadymessage,falseon a timeout or asecuritypolicyviolationfor the frame. UpdateCSP_ADVICE(use-turnstile-guard.ts:14) to nameframe-src https://sahajatlas.com. Still eager, still from the interface, never the shell.- One code path. Use the frame in every mode, including the app served on
sahajatlas.comitself and the iframe embed, rather than branching on embed mode. - Embed contract (
docs/embedding.md+CHANGELOG.md, same PR): in the CSP block (docs/embedding.md:788-795) and the "why each one" table (:810,:823,:826),challenges.cloudflare.comleavesscript-src,connect-srcandframe-src; the widget's origin joinsframe-src. Drop the note about Turnstile'sapi.jsevaluating strings in the host document (:836-850and the troubleshooting row), since that script no longer runs there. Add a "nothing to configure per site for the captcha" line to the onboarding text. Updatedocs/environment.md:22for the new mechanism. - Hosts: WeMeditateWeb's
lib/atlas-embed.tsand the WordPress plugin set no CSP, so neither needs a change. Check both after deploy. - After rollout (dashboard, by hand): remove
wemeditate.comandshrimataji.orgfrom the widget's hostname list, leavingsahajatlas.com,localhost,127.0.0.1.
Acceptance criteria
- A Turnstile challenge rendered with the production site key by the script embed on a host not on the widget's hostname list completes without
110200. - The script embed no longer loads
challenges.cloudflare.cominto the host document. Only the widget-origin frame does. - A host whose CSP blocks the challenge frame gets the captcha-blocked screen and a console line naming
frame-src, as before. -
docs/embedding.mdandCHANGELOG.mddescribe the new CSP requirement, and say that onboarding a partner needs no Turnstile step.
Verification checklist
- Probe: in Playwright, fulfil
https://www.example.org/probe(not on the hostname list) with a page that loads the builtauto.jswith the production key. Opening a registration form raises no110200, andpage.frames()showschallenges.cloudflare.comonly under the widget-origin frame. - Same probe with
Content-Security-Policy: frame-src 'none'on the host page: the widget shows the captcha-blocked screen and logs theframe-srcadvice. -
pnpm testfor the touched hooks and forms (use-turnstile,use-turnstile-guard,ReportIssueForm,CompactEmbedView.mount) passes. - On
https://shrimataji.org/test/kn/meditation-centers-in-uk/, open a class, register with a test address, and get a success, notcaptcha_failed. - On
https://wemeditate.com/map, the report-issue form's challenge solves and submits.
Decisions
- How should partner sites pass Turnstile's hostname check? → Render the challenge in a frame on
sahajatlas.com. One widget covers every host, with no per-partner step and no Enterprise plan. The other options were: keep adding hosts by hand (caps at 10), one widget per client synced through the Cloudflare API (free plan caps at 20 widgets × 10 hostnames, needs SahajCloud schema, API token and stored secrets), the Enterprise any-hostname widget (cost), and replacing Turnstile with self-hosted ALTCHA (weaker gate, new server endpoint and replay store). (Ardnived, 2026-11-01)
Notes
-
Probe, 2026-11-01 (Playwright, new headless Chromium, production key, every page a fulfilled route):
Where the challenge renders Result directly on https://www.example.org(not listed)error-callback110200×2directly on https://sahajatlas.comno error in a https://sahajatlas.comframe insidehttps://www.example.orgno error; the challenges.cloudflare.comframe loadedTurnstile checks the hostname of the document that renders it, not the top-level page. Headless cannot solve the managed challenge, so a real solve in the nested frame is the shrimataji.org check above. The iframe embed already nests the challenge the same way.
-
Turnstile free plan: 20 widgets per account, 10 hostnames per widget (a hostname covers its subdomains), no any-hostname option. https://developers.cloudflare.com/turnstile/plans/
-
SahajCloud already records each reported embed's
mode(inline|iframe) inembedMetadata(sydevs/SahajCloudsrc/lib/clients/embedMetadata.ts:36). This approach does not need it. -
Optional follow-up, not in scope: SahajCloud could check siteverify's
hostnameagainst the widget origin. -
Stop-gap, 2026-10-30:
shrimataji.orgwas added to the widget's hostname list by hand when the real key went live with the chore(build): cut sahajatlas.com over to Workers and delete Pages #283 cutover. 5 of 10 slots are used. -
Related goal: One safe intake for everything visitors submit #259 (production Turnstile key).
-
Found while preparing chore(build): cut sahajatlas.com over to Workers and delete Pages #283; not caused by the Workers cutover.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
Ardnived commentedon Nov 1, 2026
@sydevs-bot implement
sydevs-bot commentedon Nov 1, 2026
🤖 no session running
approved by Ardnived
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
docs(turnstile): correct what the challenge page's open framing costs
fix(ladle): serve the challenge page in the playground
refactor(turnstile): slim the probe verdict and the host-facing docs
feat(atlas): serve the Turnstile challenge page, pinned to an allowed…
fix(turnstile): partner hosts fail the captcha with 110200 (unknown d…
Merge origin/main into claude/feat-17-brand-map-markers
Merge origin/main into claude/feat-147-submit-a-class