feat(web): add Cloudflare Turnstile to the public forms
Render the widget on the contact, event registration and both application forms, and verify the token with Siteverify in each action before anything is written to the CMS. Verification fails closed. The check is off unless both TURNSTILE_SITE_KEY and TURNSTILE_SECRET_KEY are set. Allow challenges.cloudflare.com in script-src and frame-src. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -45,8 +45,10 @@ function contentSecurityPolicy(nonce: string): string {
|
||||
const mediaOrigin = new URL(STRAPI_URL).origin;
|
||||
const directives = [
|
||||
"default-src 'self'",
|
||||
`script-src 'self' 'nonce-${nonce}' 'strict-dynamic' https://www.googletagmanager.com`,
|
||||
`script-src 'self' 'nonce-${nonce}' 'strict-dynamic' https://www.googletagmanager.com https://challenges.cloudflare.com`,
|
||||
"script-src-attr 'none'",
|
||||
// The Turnstile widget on the public forms renders in Cloudflare's iframe.
|
||||
"frame-src https://challenges.cloudflare.com",
|
||||
"style-src 'self' 'unsafe-inline'",
|
||||
`img-src 'self' ${mediaOrigin} https://www.google-analytics.com data: blob:`,
|
||||
`media-src 'self' ${mediaOrigin} data: blob:`,
|
||||
|
||||
Reference in New Issue
Block a user