Skip to content

docs(embedding): measure a Turnstile challenge solved under the documented CSP - #276

Merged
sydevs-bot merged 7 commits into
mainfrom
claude/docs-274-turnstile-csp-solve
Oct 11, 2026
Merged

sydevs-bot merged 7 commits into
mainfrom
claude/docs-274-turnstile-csp-solve

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A forced interactive challenge solves on the documented CSP with no 'unsafe-eval', so the policy block is unchanged.
  • The refused eval is 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 it

 script-src … challenges.cloudflare.com          # the policy block itself is untouched
-Six notes on that table                         # a count nothing enforces, wrong at that value
+Notes on that table
-A refused `eval` is EXPECTED on this exact policy
-A challenge being SOLVED under it has not been measured
+A forced interactive challenge SOLVES on it — 6 of 6, Chromium 141.0.7390.37, 2026-10-11
+  three runs on the policy verbatim, three with `'unsafe-eval'` added, identical
+  the challenge answers to its own frame's `'unsafe-eval'`, so `frame-src` is the only
+    directive of yours that governs it — which is why Cloudflare's own Turnstile CSP
+    guidance asks for script-src + frame-src, and nothing else
+The refusal is NOT produced by every page view — absent from all 15 runs on 2026-10-11
+  nine in the embed: 3 on the policy verbatim, 3 with `'unsafe-eval'`, 3 on the 2026-10-10 setup
+  plus six on an isolated `api.js` page
+  it is `api.js`, which runs in your document and which your `script-src` does govern
+  the refusal beside a failing solve is the one state nobody has observed — report it
+Uncovered: the production site key, the submission itself, map mode

Contract — docs/embedding.md, the Troubleshooting row for the console message

-Expected on the recommended CSP, harmless in every measured run
+`api.js` evaluating a string in YOUR document; harmless wherever it has appeared
+  and not on every page view; the challenge runs under Cloudflare's own policy
+  and solved on this CSP in later runs, which did not show the refusal
 Still NOT the blocked-Turnstile row below

Contract — README.md, what each third party learns

-challenges.cloudflare.com loads Turnstile only when a visitor opens the report-issue form
+challenges.cloudflare.com loads Turnstile as soon as the interface mounts (#182)

Stale since #182 inverted that behaviour: FullInterface calls useTurnstileGuard, 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, the VITE_TURNSTILE_SITE_KEY row

-Unset, the form defaults to `mailto:`
+Unset, `probeTurnstile` answers false and the widget fails to the captcha-blocked screen
+  the same state as a CSP-refused script, and no `mailto:` since #182

The same premise #182 deleted, surviving in the one .md the first pass missed. ReportIssueForm.test.tsx asserts 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.dev

Test results

  • Lean gate: ✓ pnpm lint && pnpm typecheck && pnpm test:run — 1682 tests, 136 files, re-run after the review commits
  • Targeted specs: none — no spec pins this prose
  • Build: ✓ pnpm build (run twice to produce the embeds under measurement, not as a gate)

Manual verification

  1. The claim this PR adds rests on a run, not on a file. To repeat it: build with VITE_TURNSTILE_SITE_KEY=3x00000000000000000000FF, serve dist/ and a host page from one origin with docs/embedding.md:788-795 sent as a Content-Security-Policy response header, open the report-issue form, click the challenge, and watch Submit enable.
  2. Not done, and not doable from a routine: the production site key. Acceptance criterion 1 asks for it; it lives in the Cloudflare Pages environment and no cloud session can hold it. Someone with it can repeat step 1 against sahajatlas.com's key and date the result the same way.

Notes for reviewer

  • Closes #274 retires 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.
  • Why a test key answers anything. docs(embedding): re-measure what style-src breaks, and name Turnstile's refused eval #271 measured 1x…AA out — it short-circuits and renders no challenge. 3x00000000000000000000FF forces the real interactive one: the real challenges.cloudflare.com frame, the real click, a real success state. That is the gap docs(embedding): settle whether Turnstile needs 'unsafe-eval' in script-src #272 raised, closed as far as a repeatable check can close it.
  • The judgement I want checked. The 2026-10-10 refusal did not reproduce, so "a page showing the refusal still solves" is unproven and the note now says so outright rather than implying it. The alternative was to delete the refusal note; keeping it dated and requalified seemed better, since a host who sees it needs the sentence.
  • The paragraph count is gone rather than corrected. :828 read "Six" against twelve bold-led notes before this branch. Nothing enforces it, and every edit to the section moves it.
  • No CHANGELOG.md entry, by that file's own rule: documentation is left out, and a host observes no change — the policy block gains nothing.
  • The '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 high raised the same overreach across three findings, fixed in b6f4684. 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-795 verbatim as a response header, with 'self' added to script-src and font-src to stand in for https://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.

configuration runs solved violations
built map=false embed, report-issue form, 3x…FF 3 3 0
same, 'unsafe-eval' added to script-src 3 3 0
same, 1x…AA — the 2026-10-10 setup 3 n/a (auto) 0
isolated page, api.js?render=explicit, 3x…FF 3+3 6 0

Nine 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: ReportIssueForm gates Submit on !isValid || !token, so with both text fields filled, Submit enabling is the token arriving in useTurnstile's state.

The challenge frame's own policy, read out of the live frame inside the running widget:

default-src 'none'; script-src 'nonce-…' 'unsafe-eval'; script-src-attr 'none';
worker-src blob:; style-src 'unsafe-inline'; img-src 'self'; connect-src 'self' …;
frame-src 'self' blob:; form-action 'none'; base-uri 'self'; trusted-types … ;
require-trusted-types-for 'script'

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-src has 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/ answered 429 in 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_ACCESSTOKEN this 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

…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
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

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

View logs

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 11, 2026
@sydevs-bot

sydevs-bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 16:30Z address-review · attempt 1 · session · done
  • 16:30Z address-review · attempt 1 · session
  • 16:21Z review-pr · attempt 1 · session · done
  • 16:21Z review-pr · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧐 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:22 still says "Unset, the form defaults to mailto:". #182 deleted that degradation: with no key useTurnstileGuard fails the widget, and ReportIssueForm.test.tsx:196 asserts no mailto:. Same stale premise this PR fixes in README.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 :828 count 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

Comment thread docs/embedding.md Resolved
Comment thread docs/embedding.md Resolved
Comment thread README.md Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 11, 2026
"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
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

All four review points adopted. Lean gate green after each — 1682 tests, 136 files. Head 242c3d2.

Asked, in the body rather than here: Closes #274 retires a ticket with AC1 unverified. Strike AC1 on merge, or drop the keyword. I did not edit #274.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 11, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review October 11, 2026 16:40
@sydevs-bot
sydevs-bot requested a review from Ardnived October 11, 2026 16:40
@sydevs-bot
sydevs-bot enabled auto-merge October 11, 2026 16:40
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 11, 2026
Comment thread docs/embedding.md

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.

@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

Merged via the queue into main with commit 9bb854a Oct 11, 2026
54 of 58 checks passed
@sydevs-bot
sydevs-bot deleted the claude/docs-274-turnstile-csp-solve branch October 11, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

docs(embedding): measure a Turnstile challenge under the documented CSP

3 participants