Skip to content

Commit 7449037

Browse files
tbjersclaude
andauthored
fix: relax CSP to allow SvelteKit bootstrap and Cloudflare edge scripts (#20)
The strict default-src 'self' policy blocked three categories of content that cannot be handled with build-time hashes: - SvelteKit's inline bootstrap script in index.html - Scripts injected by Cloudflare at the edge (Web Analytics, etc.) whose content is unknown at build time — once any hash appears in script-src, browsers ignore 'unsafe-inline', so hash mode is not a viable escape hatch - The Cloudflare Insights beacon loaded from static.cloudflareinsights.com - The style="display:contents" attribute SvelteKit emits on its body wrapper Adds explicit script-src and style-src directives with 'unsafe-inline' and the Cloudflare Insights origin/connect-src. The dashboard is already gated by Cloudflare Access, so CSP here is defence-in-depth rather than the primary XSS control. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c8f2768 commit 7449037

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

dashboard/static/_headers

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
X-Frame-Options: DENY
33
X-Content-Type-Options: nosniff
44
Referrer-Policy: strict-origin-when-cross-origin
5-
Content-Security-Policy: default-src 'self'; img-src 'self' https://avatars.githubusercontent.com; connect-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'
5+
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' https://static.cloudflareinsights.com; style-src 'self' 'unsafe-inline'; img-src 'self' https://avatars.githubusercontent.com; connect-src 'self' https://cloudflareinsights.com; frame-ancestors 'none'; base-uri 'self'; form-action 'self'

0 commit comments

Comments
 (0)