Skip to content

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

Closed

Description

@sydevs-bot

Summary

docs/embedding.md now tells a host that the refused eval they see on the recommended CSP is
expected and harmless. What it still says has not been measured is a Turnstile challenge being
solved under that policy. Every write the widget makes is captcha-gated, so if a solve needs
'unsafe-eval', the recommended policy silently costs a visitor their registration.

#272 held this question and #271 closed it, having
answered the documentation half and ruled out the cheap route. This ticket owns the half that
remains, so the gap has an owner rather than a sentence.

Approach

A routine cannot do this, which is why it is a ticket and not a finding. Two credentials are
needed and neither can reach a cloud session: the production VITE_TURNSTILE_SITE_KEY (held in
the Cloudflare Pages environment) and a SahajCloud client key the backend accepts. .env ships
the always-passes test key 1x00000000000000000000AA.

That test key is now measured, not suspected. Chromium 141, 2026-10-10, an isolated page
sending the documented policy as a response header and loading
api.js?render=explicit exactly as src/hooks/use-turnstile.ts does: turnstile.render
succeeds, hands back the literal XXXX.DUMMY.TOKEN.XXXX, renders no challenge iframe, and trips
no securitypolicyviolation at all — under the documented policy and with 'unsafe-eval'
added, 3 runs each. So the test key short-circuits before any code path that evals, and cannot
answer this question however it is driven. #272's ⚠ guessed this; it is
confirmed.

Three places move depending on the answer:

  • docs/embedding.md:788 — the script-src line in the policy block, if 'unsafe-eval' is
    required.
  • docs/embedding.md:830 — the note naming the refusal expected and harmless. It is currently
    worded as what was observed, not as something every page view must produce.
  • docs/embedding.md:1224 — the troubleshooting row for the console message, which currently
    sends a host away from the fatal blocked-Turnstile row above it.

Acceptance criteria

Verification checklist

  • pnpm build, then serve dist/ and a host page from one origin with a
    Content-Security-Policy response header. pnpm review:embed sends no header, so front it
    with a proxy or a throwaway server.
  • Build with the production VITE_TURNSTILE_SITE_KEY and a client key the backend accepts,
    and confirm the rendered challenge is not the dummy-token path — a challenge iframe from
    challenges.cloudflare.com must appear.
  • Send the policy from docs/embedding.md:787-796 verbatim. Open the report-issue form,
    solve the challenge, and record whether a token is produced and the submission accepted.
  • Repeat with 'unsafe-eval' added to script-src, and compare.
  • Record the securitypolicyviolation entries 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:run pass.

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. #272 raised this question. #271
answered its documentation half and measured the test key out.

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

Activity

  1. added theissue type on Oct 10, 2026
  2. added
    proposal
    on Oct 10, 2026
  3. Ardnived commented on Oct 11, 2026

    @Ardnived
    Contributor

    @sydevs-bot implement

  4. removed
    proposal
    on Oct 11, 2026
  5. moved this from Proposed to Approved in SYDevelopers Technical Roadmapon Oct 11, 2026
  6. added
    bot:working
    on Oct 11, 2026
  7. sydevs-bot commented on Oct 11, 2026

    @sydevs-bot
    ContributorAuthor

    🤖 no session running

    recent dispatches
    • 15:41Z implement · attempt 1 · session · done
    • 15:41Z implement · attempt 1 · session

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

  8. removed
    bot:working
    on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    Medium

    Hold Until

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions