Repository navigation
Description
Summary
A host following docs/embedding.md's CSP block gets an EvalError in their console on every
page view. Turnstile evaluates a string as JavaScript, and the documented script-src carries no
'unsafe-eval'. The widget kept working in every run, so the recommended policy may well be
right — but the guide says nothing about the refusal, and nobody has checked whether a challenge
can actually be solved under it. Every write the widget makes is captcha-gated, so that gap
matters more than a console message.
Found incidentally while measuring style-src for #263.
Approach
What was observed (Chromium 141, 2026-10-10, a built map=false embed served from one localhost
origin under the exact policy in docs/embedding.md:789-798, SahajCloud stubbed per
docs/rules/mapbox.md):
- A
securitypolicyviolationwitheffectiveDirective: "script-src"andblockedURI: "eval",
3 runs out of 3. - The console message:
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' https://api.mapbox.com https://challenges.cloudflare.com https://cdn.usefathom.com". - The violation has
source: nulland no stack, which is what a cross-origin script produces.
It fires oncehttps://challenges.cloudflare.com/turnstile/v0/g/<id>/api.jshas loaded, and it
fires on a route where the place-search library never mounts — so the geocoder is ruled out. grep -c 'new Function(\|[^.$a-zA-Z_]eval('over every chunk indist/assets/is zero, so
the call is not in our bundle.- The widget rendered, routed and read its data normally in every run. Nothing visible failed.
What was not established, and is the point of this ticket: whether the Turnstile challenge
completes and yields a token under that policy. The runs had no configured report form
(sy-atlas-config.reportIssueForm was null in the stub) and no registration path, so the captcha
was loaded but never solved.
Three places move depending on the answer:
docs/embedding.md:789-798— the policy block, if'unsafe-eval'turns out to be required.docs/embedding.md:811— thescript-src/challenges.cloudflare.comrow, whose "Blocked ⇒"
column already says a blocked Turnstile stops the widget outright.docs/embedding.md's troubleshooting table — a host who sees thisEvalErrorand finds nothing
about it in the guide has no way to tell a harmless refusal from the fatal one above it.
CHANGELOG.md gets an entry only if the recommended policy changes. A note about a refusal that
costs nothing is guide accuracy, not something a host can observe.
⚠ Do not answer this from the Turnstile docs alone. Cloudflare ships more than one challenge
mode and this repo pins the always-passes test site key in .env (VITE_TURNSTILE_SITE_KEY,
1x00000000000000000000AA), which may not exercise the same code path as the production key. The
question is what the production key does on a host page, under this policy.
Acceptance criteria
- It is established, in a browser, whether a Turnstile challenge yields a token under the
documentedscript-srcwith no'unsafe-eval', using the production site key. - If it does:
docs/embedding.mdnames theEvalErroras expected and harmless, so a host
does not mistake it for the fatal blocked-Turnstile row, and the policy block is unchanged. - If it does not:
'unsafe-eval'joins thescript-srcline in the policy block, the row
says why, andCHANGELOG.mdcarries an entry — a host can observe this one. - Either way the claim is dated and names the browser, as the
style-srcnote added in
docs(embedding): re-measure what a missingstyle-src 'unsafe-inline'actually breaks #263 does.
Verification checklist
-
pnpm build, then servedist/and a host page from one origin with a
Content-Security-Policyresponse header.pnpm review:embedsends no header, so front it
with a proxy or a throwaway server. - Send the policy from
docs/embedding.md:789-798verbatim, with the production
VITE_TURNSTILE_SITE_KEYbuilt in, and a client key the backend accepts. - Open the report-issue form, solve the challenge, and record whether a token is produced and
whether the submission is accepted. - Repeat with
'unsafe-eval'added toscript-srcand compare. - Record the
securitypolicyviolationentries and console text from both runs. -
grep -n "unsafe-eval" docs/embedding.md— every hit agrees with what was measured. -
pnpm lint && pnpm typecheck && pnpm test:runpass.
Notes
No automated lane can hold this. The smoke lane reads deployed file content over fetch, so
it cannot observe a CSP decision made by a rendering engine — docs/testing.md states the same
limit. The guard is that the claim was observed once and dated.
Related: #182 made Turnstile essential and wrote the script-src and
frame-src rows this ticket would amend. #263 is the style-src half of the
same table, found by the same harness.
🤖 Written by the sydevs autonomous loop — see what this is
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity