CSP blocks inline styles: admin panel renders unlocked, theme swatches stripped (regression from #84) #116
Notifications
Total Time Spent: 30 minutes
fen
30 minutes
No due date set.
Dependencies
No dependencies set.
Reference: poslop/palette#116
Reference in New Issue
Block a user
Regression from #84 (CSP header): the Content-Security-Policy
default-src 'self'(no style-src) BLOCKS all inline style attributes, including the page's own.Reproduced in headless Chromium on the dev server - console shows:
Applying inline style violates the following Content Security Policy directive 'default-src 'self'' ... style attributes ... The action has been blocked.(admin page, lines 40/44)Visible consequences:
style="display:none"is stripped by CSP, so the full settings form renders WITHOUT unlocking - defeats #99 and the #113 lock redesign.style="background:..."- blocked, contributing to the broken theme grid (alongside the t.colors bug fixed by #114).Fix: add
style-src 'self' 'unsafe-inline'to the CSP header (keep script-src tight). The app legitimately uses inline style attributes for dynamic theming; hashes/nonces are impractical for runtime-generated style attributes. Then verify in a real browser: /admin shows ONLY the lock on fresh load, /settings theme cards render with colored swatches, and the CSP header contains style-src.QA passed (independent verification, headless Chromium + local build + live palette-dev):
073d39c).aca99bc), CI test+docker green, palette-dev redeployed (rollout successful).