From 6389ec06a2c44f6ec063d107d44d0ca28908aca1 Mon Sep 17 00:00:00 2001 From: James Xylight Date: Mon, 14 Jul 2025 16:43:28 -0700 Subject: [PATCH] security: add a content security policy --- svelte.config.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/svelte.config.js b/svelte.config.js index 1bec4348..b2323410 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -25,14 +25,16 @@ const config = { }, }) : auto(), - // csp: { - // directives: { - // 'script-src': ['self'], - // 'object-src': ['none'], - // 'base-uri': ['none'] - // }, - // mode: 'nonce' - // } + 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': ['/'], + }, + }, alias: { 'mono-svelte': 'src/lib/mono', },