Commit 7449037
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
0 commit comments