Repository navigation
docs(embedding): measure a Turnstile challenge solved under the documented CSP - #276
Conversation
…ented CSP The CSP note said a refused `eval` was expected on the recommended policy and harmless, and that what had not been measured was a challenge being *solved* under it. Every write the widget makes is captcha-gated, so that gap was the one that could cost a visitor their registration. Measured against the real embed: a built `map=false` bundle and a host page served from one origin, the policy block sent verbatim as a response header, and the challenge driven in the widget's own report-issue form. Cloudflare's `3x00000000000000000000FF` test key forces the real interactive challenge, so this exercises the code the always-passes key short-circuits past — the gap #272 raised and #271 measured the test key out over. Chromium 141.0.7390.37, 2026-10-11, six runs of six — three on the policy verbatim, three with `'unsafe-eval'` added: - The challenge reached its success state and the widget took the token, with Submit going from disabled to enabled on every run. - No `securitypolicyviolation` fired at all, with or without `'unsafe-eval'`. - The challenge document sends its own `script-src 'nonce-…' 'unsafe-eval'`, which is why a host's `script-src` cannot bind it: the frame is cross-origin, so `frame-src` is the only directive that reaches it. So the policy block is unchanged and gains no `'unsafe-eval'`, and no CHANGELOG entry is owed — a host observes nothing new. The refused `eval` itself is requalified rather than removed. It did not occur once in 12 runs across three configurations, the 2026-10-10 setup among them, so the note now reads as harmless when seen and normal when absent, and the troubleshooting row says the same. What the runs did not cover is named in the note: the production site key, the submission itself, and map mode for want of a Mapbox token. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CcQDZX2qxxuZE9Wd1sGGLe
The first draft read as though a page showing the refused `eval` had been watched solving a challenge. It had not: the 2026-10-11 runs solved and saw no refusal, and the 2026-10-10 runs saw the refusal and solved nothing. Naming that pairing as the one state nobody has observed is the useful thing to publish, and it asks a host who hits it to say so. Two smaller corrections fall out of the same read: - "the code that evaluates strings is covered by Cloudflare's policy, not yours" contradicted the refusal reported against the host's own `script-src` two paragraphs later. There are two evals: the challenge's, inside the frame, and `api.js`'s, in the host document. Only the second is a host's to see, and the note now says which is which. - The verbatim-vs-`'unsafe-eval'` comparison can only report that both runs behaved identically, since neither attempted an eval. It no longer carries the conclusion on its own — Cloudflare's own CSP guidance for Turnstile, which asks for `script-src` and `frame-src` and nothing else, is cited beside it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CcQDZX2qxxuZE9Wd1sGGLe
The third-party list still described the pre-#182 behaviour: the script loading only when a visitor opens the report-issue form. `FullInterface` calls `useTurnstileGuard`, which probes Turnstile on mount, so a visitor's request reaches Cloudflare on every interface render. That timing is the point of the section it sits in — this list is what a host tells their own visitors — and `docs/embedding.md` has had it right since #182. Found while measuring the CSP for #274: the challenge script was already requested before the form was opened, in every run. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CcQDZX2qxxuZE9Wd1sGGLe
Deploying sahajatlas with
|
| Latest commit: |
242c3d2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://11e87196.sahajatlas.pages.dev |
| Branch Preview URL: | https://claude-docs-274-turnstile-cs.sahajatlas.pages.dev |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Docs-only, and the measurement is real. A forced interactive challenge solving on the policy verbatim is what #274 asked for, and the policy block is rightly untouched. Two things to settle. Closes #274 retires a ticket whose first acceptance criterion the body says was not met, and that ticket exists because no routine can hold the production key. My read: 3x…FF does answer the CSP question, since the eval is inside Cloudflare's frame under Cloudflare's own 'unsafe-eval' and the key changes only domain binding and difficulty. So strike AC1 on the ticket rather than close it silently. Second, four notes now replace one for an outcome of "the claims are unchanged".
Findings
- should-fix —
docs/embedding.md:852: "12 runs across three configurations" reconciles with no row grouping in the body table. - should-fix —
docs/environment.md:22still says "Unset, the form defaults tomailto:". #182 deleted that degradation: with no keyuseTurnstileGuardfails the widget, andReportIssueForm.test.tsx:196asserts nomailto:. Same stale premise this PR fixes inREADME.md, so it belongs here. No hunk to anchor it to. - consider —
docs/embedding.md:839: the aggregate — four notes, +25 lines, the mechanism stated three times — and the:828count now matches nothing. - consider —
README.md:104: the failure-mode clause repeats the CSP table inside a privacy section.
What was checked. The diff from the checkout, 2 files, +40/−15. #274's five criteria one by one. use-turnstile.ts, use-turnstile-guard.ts and ReportIssueForm.test.tsx for the load-timing claim — mount-eager, and docs/embedding.md:810 already carried it. grep -n unsafe-eval docs/embedding.md: no hit in the policy block, so AC2 holds. Every .md grepped for the #182 premise; environment.md is the one survivor. Profile read.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
"12 runs across three configurations" reconciled with no grouping of the measured runs: the embed arms are nine across three, and the isolated `api.js` page six more. The count carries the requalification, so a host checking it has to be able to close the arithmetic. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SJwfH5yFxxiRSbdAdWy12a
Four notes stood where one did, and the frame-policy mechanism was stated three times. It belongs in the solve note, as the reason "do not add `'unsafe-eval'`" is safe advice; the `api.js` half belongs in the refusal note, which is the only place that uses it. The paragraph count went too. It read "Six" before this branch and "Nine" after, against thirteen bold-led notes either way — nothing enforces it, and every edit to the section moves it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SJwfH5yFxxiRSbdAdWy12a
The failure mode is not privacy, and it is already the `script-src` row in the CSP table and the troubleshooting row this section links to two lines down. What the section owes is the load timing: a visitor's request reaches Cloudflare on every interface render. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SJwfH5yFxxiRSbdAdWy12a
#182 deleted that degradation. With no key `probeTurnstile` answers false and `useTurnstileGuard` throws, so the widget fails to the captcha-blocked screen; `ReportIssueForm.test.tsx` asserts no inbox is offered. Same stale premise this branch fixes in README.md, and the last `.md` carrying it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SJwfH5yFxxiRSbdAdWy12a
|
All four review points adopted. Lean gate green after each — 1682 tests, 136 files. Head
Asked, in the body rather than here: 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
There was a problem hiding this comment.
@sydevs-bot We've added too much technical detail to embedding.md. This file is intended for non-technical users to incorporate the Atlas with simple clear instructions that could guide a non-technical user. Raise a new PR to properly address this
Summary
'unsafe-eval', so the policy block is unchanged.evalis requalified, not removed: absent from every 2026-10-11 run.Change outline
The host-facing contract is prose, so each view paraphrases it one rule per line.
Contract —
docs/embedding.md, the notes under Why each one, and what breaks without itContract —
docs/embedding.md, the Troubleshooting row for the console messageContract —
README.md, what each third party learnsStale since #182 inverted that behaviour:
FullInterfacecallsuseTurnstileGuard, which probes on mount. Found while measuring, and privacy-relevant in the section it sits in — a visitor's request reaches Cloudflare on every interface render, not only when a form opens.Contract —
docs/environment.md, theVITE_TURNSTILE_SITE_KEYrowThe same premise #182 deleted, surviving in the one
.mdthe first pass missed.ReportIssueForm.test.tsxasserts the form names no inbox.Preview
Docs only — nothing in the deploy changes, and no route differs from
main. Branch alias: https://claude-docs-274-turnstile-cs.sahajatlas.pages.devTest results
pnpm lint && pnpm typecheck && pnpm test:run— 1682 tests, 136 files, re-run after the review commitspnpm build(run twice to produce the embeds under measurement, not as a gate)Manual verification
VITE_TURNSTILE_SITE_KEY=3x00000000000000000000FF, servedist/and a host page from one origin withdocs/embedding.md:788-795sent as aContent-Security-Policyresponse header, open the report-issue form, click the challenge, and watch Submit enable.sahajatlas.com's key and date the result the same way.Notes for reviewer
Closes #274retires that ticket with AC1 unverified. Step 2 above says why no routine can verify it. Strike AC1 when you merge, or drop the keyword and leave docs(embedding): measure a Turnstile challenge under the documented CSP #274 open for whoever holds the key. I did not edit the ticket — that call is yours.style-srcbreaks, and name Turnstile's refusedeval#271 measured1x…AAout — it short-circuits and renders no challenge.3x00000000000000000000FFforces the real interactive one: the realchallenges.cloudflare.comframe, the real click, a real success state. That is the gap docs(embedding): settle whether Turnstile needs'unsafe-eval'inscript-src#272 raised, closed as far as a repeatable check can close it.:828read "Six" against twelve bold-led notes before this branch. Nothing enforces it, and every edit to the section moves it.CHANGELOG.mdentry, by that file's own rule: documentation is left out, and a host observes no change — the policy block gains nothing.'unsafe-eval'comparison can only report that both arms behaved identically, since neither attempted an eval. It no longer carries the conclusion alone./code-review highraised the same overreach across three findings, fixed inb6f4684. The adversarial review's four points are answered in the thread replies and the summary comment; nothing was dismissed.Detail
Harness. A node server sending
docs/embedding.md:788-795verbatim as a response header, with'self'added toscript-srcandfont-srcto stand in forhttps://sahajatlas.com— the doc says a host's own sources still have to be in there. Playwright drove Chromium 141.0.7390.37. Egress ran through this environment's inspecting proxy, which re-terminates TLS; the challenge content and its own CSP arrived intact.Runs, all under the policy above.
map=falseembed, report-issue form,3x…FF'unsafe-eval'added toscript-src1x…AA— the 2026-10-10 setupapi.js?render=explicit,3x…FFNine embed runs across three configurations, plus six on the isolated page: fifteen, none of them showing the refusal. That is the arithmetic the doc now states per configuration, instead of the "12 across three" that reconciled with no grouping of this table.
The solve is read off the form, not off a console line:
ReportIssueFormgates Submit on!isValid || !token, so with both text fields filled, Submit enabling is the token arriving inuseTurnstile's state.The challenge frame's own policy, read out of the live frame inside the running widget:
That is the mechanism the solve note now carries in one sentence: the eval the challenge needs is granted by Cloudflare inside its own document, where a host's
script-srchas no reach. It stood as a note of its own until the review pointed out the section states it three times.One unrelated observation.
https://ipwho.is/answered429in every run from this environment's IP. The widget degraded exactly as documented — no nearby suggestion, everything else normal — so it is noted rather than filed.Not measured, beyond the production key: no submission was posted (the backend would reject a dummy token, and the form delivers real email since #103), and map mode needs a
VITE_MAPBOX_ACCESSTOKENthis environment has not got — the same gap #271 recorded.Closes #274
🤖 Generated with Claude Code
https://claude.ai/code/session_01CcQDZX2qxxuZE9Wd1sGGLe
Generated by Claude Code