feat: enable SvelteKit CSP policy with hash-based inline script/style protection

This commit is contained in:
midzelis
2026-02-28 20:00:47 +00:00
parent 0560f98c2d
commit 5194643571
2 changed files with 97 additions and 0 deletions
+25
View File
@@ -22,6 +22,31 @@ const config = {
fallback: 'index.html',
precompress: true,
}),
csp: {
mode: 'hash',
directives: {
'default-src': ['self'],
'script-src': [
'self',
'https://www.gstatic.com',
'wasm-unsafe-eval',
'sha256-h5wSYKWbmHcoYTdkHNNguMswVNCphpvwW+uxooXhF/Y=',
],
'style-src': ['self', 'unsafe-inline'],
'img-src': ['self', 'data:', 'blob:'],
'connect-src': [
'self',
'blob:',
'https://pay.futo.org',
'https://static.immich.cloud',
'https://tiles.immich.cloud',
],
'worker-src': ['self', 'blob:'],
'frame-src': ['none'],
'object-src': ['none'],
'base-uri': ['self'],
},
},
alias: {
$lib: 'src/lib',
'$lib/*': 'src/lib/*',