Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion shared/utils/securityHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ export const CSP_SOURCES = {
// 'unsafe-inline': Nuxt inlines `window.__NUXT__` and the payload bootstrap.
// A nonce would differ per request, and pages are cached and shared at the
// edge; a hash would change with every page. Revisit with a build-time hash step.
'script-src': ["'self'", "'unsafe-inline'"],
// static.cloudflareinsights.com: Web Analytics beacon, injected by Cloudflare at the edge.
'script-src': [
"'self'",
"'unsafe-inline'",
'https://static.cloudflareinsights.com'
],
// Vue's `style` bindings and Nuxt's inlined critical CSS are inline styles.
'style-src': ["'self'", "'unsafe-inline'"],
// img.onelitefeather.net: @nuxt/image's Cloudflare provider. The other two
Expand Down
6 changes: 5 additions & 1 deletion tests/architecture/security-headers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ describe('content security policy source list', () => {
it('allows exactly these sources', () => {
expect(CSP_SOURCES).toEqual({
'default-src': ["'self'"],
'script-src': ["'self'", "'unsafe-inline'"],
'script-src': [
"'self'",
"'unsafe-inline'",
'https://static.cloudflareinsights.com'
],
'style-src': ["'self'", "'unsafe-inline'"],
'img-src': [
"'self'",
Expand Down
Loading