From 5661694dd721b88dc244925242014936b34287c3 Mon Sep 17 00:00:00 2001
From: M <>
Date: Mon, 14 Sep 2026 21:38:10 +0200
Subject: [PATCH] CON-44: a Content-Security-Policy behind the Markdown
sanitiser
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The app renders Markdown written by arbitrary public keys, and the sanitiser is
the only thing standing between that and script execution. This adds the second
layer: one policy in `src/csp.ts`, pinned by `src/csp.test.ts`, delivered as an
HTTP response header — never as ``, which ignores
`frame-ancestors`, the directive this policy needs.
`script-src 'self'` with no `'unsafe-inline'` and no `'unsafe-eval'` is the
directive that matters, so the theme bootstrap moved out of `index.html` into
`public/theme-bootstrap.js`; it stays classic and render-blocking, or a reload
flashes light mode. `style-src` keeps `'unsafe-inline'` because CodeMirror
mounts its theme through style-mod, which assigns `textContent` to a `