From a3bf0b26e55e7d6f1602568b89dff66b676dab79 Mon Sep 17 00:00:00 2001 From: Adam French Date: Tue, 22 Sep 2026 23:26:16 +0100 Subject: [PATCH] csp: allow wasm-unsafe-eval so Rust AutoScroll WASM loads 03e10be added a CSP to the SPA document; default-src 'self' without 'wasm-unsafe-eval' blocks WebAssembly.instantiateStreaming, killing the wasm port of AutoScroll. Keyword permits wasm compilation only, not JS eval. Co-Authored-By: Claude Code --- nginx/security_headers.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nginx/security_headers.conf b/nginx/security_headers.conf index 355b2df..c1f43b3 100644 --- a/nginx/security_headers.conf +++ b/nginx/security_headers.conf @@ -14,4 +14,9 @@ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" alway # Applied to the main document; the /uploads/ blocks override with their own # locked-down CSP by declaring Content-Security-Policy again themselves # (a later add_header of the same name within one response wins). -add_header Content-Security-Policy "default-src 'self'; img-src 'self' data: https:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; connect-src 'self'; frame-ancestors 'self'; base-uri 'self'; object-src 'none'" always; +# 'wasm-unsafe-eval' is needed for WebAssembly compilation (the Rust +# AutoScroll module, vue/crates/stp_wasm): without it script-src falls back +# to default-src 'self', which blocks WebAssembly.instantiateStreaming() in +# every modern browser. It allows wasm compilation only, not JS eval, so it +# is the narrowest keyword that unblocks the feature. +add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; img-src 'self' data: https:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; connect-src 'self'; frame-ancestors 'self'; base-uri 'self'; object-src 'none'" always;