From b872db9eaf00336252df8bfb2cd985a27f5facbe Mon Sep 17 00:00:00 2001 From: xylight <80978739+Xyphyn@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:09:02 -0800 Subject: [PATCH] security: add csp (#689) --- svelte.config.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/svelte.config.js b/svelte.config.js index 7cefec0a..68d6e606 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,8 +1,8 @@ -import node from '@sveltejs/adapter-node' -import bun from 'svelte-adapter-bun-next' import auto from '@sveltejs/adapter-auto' +import node from '@sveltejs/adapter-node' import staticAdapter from '@sveltejs/adapter-static' import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' +import bun from 'svelte-adapter-bun-next' /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -36,6 +36,16 @@ const config = { 'svelte-hero-icons': 'node_modules/@xylightdev/svelte-hero-icons', $comp: 'src/lib/components', }, + csp: { + directives: { + 'script-src': ['self'], + }, + // must be specified with either the `report-uri` or `report-to` directives, or both + reportOnly: { + 'script-src': ['self'], + 'report-uri': ['/'], + }, + }, }, }