From 5305d3bb5e9f0eb6b4062705e899f4670776fa3d Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 12 Aug 2026 14:21:10 -0400 Subject: [PATCH] docs: correct the CSP entry in TODO.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Scripted EPUBs are a regression from the foliate migration, not a pre-existing gap: epub.js sandboxed without allow-scripts by default, foliate sets it unconditionally. Records grimmory's fix — CSP on per-entry responses rather than app-wide — which also sidesteps the mode-watcher blocker, plus the whole-file buffering it would remove. --- TODO.md | 81 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 63 insertions(+), 18 deletions(-) diff --git a/TODO.md b/TODO.md index 7a94b31..17bc31e 100644 --- a/TODO.md +++ b/TODO.md @@ -51,28 +51,73 @@ Worth adding at the same time: ## Frontend -### No CSP, so scripted EPUBs run against the app origin +### Scripted EPUBs run against the app origin -EPUB files may contain JavaScript. foliate-js renders each section in an iframe from a -**same-origin** `blob:` URL and cannot sandbox it — `allow-scripts` is required, and -blob URLs inherit the embedder's origin — so script inside a book can reach `/api/*` -with the session cookie attached. foliate's own README says not to use it without a -Content Security Policy blocking scripts. +**This is a regression from the foliate-js migration, not a pre-existing gap.** -The obvious policy is `kit.csp` in `svelte.config.js` with `script-src: ['self']`, and -deliberately no `default-src` (it would also cover `style-src`/`img-src`/`font-src` and -kill both the book's own blob: assets and the inline `