[LOW] CSP allows unsafe-inline for script-src and style-src #139
Notifications
Total Time Spent: 1 hour
fen
1 hour
No due date set.
Dependencies
No dependencies set.
Reference: poslop/palette#139
Reference in New Issue
Block a user
content-security-policy: default-src self; script-src self unsafe-inline; style-src self unsafe-inline; frame-ancestors none. No exploitable sink was found in this audit (titles escaped server- and client-side), so this is hardening: any future innerHTML slip becomes stored XSS. Note the inline theme-resolution script in the head currently requires it.
Repro
Found during exploratory security/bug pass on palette-dev (2026-09-09). Reporting only, no fix attached.
Fix proposal: move the small inline boot script into /static/app.js and restrict script-src to self (drop unsafe-inline). style-src unsafe-inline is still needed for the runtime-generated theme swatch backgrounds unless swatches move to CSS custom properties on data-preset.
QA PASS — verified live on palette-dev (image digest 1200177b3d1c = CI docker run for merge commit 5a227e2; PR #159 merged into dev).
Rendered-output verification (headless chromium via CDP, every page):
22c6624(PR #129 added a $("#iscan") guard into create() while the iscan checkbox was dropped in mergef1b5dd0) — it crashes on the pre-#159 build too, unrelated to this CSP change. Server-side create API works (201); paste view, copy, raw, attachment render all clean. Filing a separate issue for the create-button crash.Merged, deployed, closing. fix-139 branch deleted.