From 601687872a496d2e8f0f17474bd399b98c39a8cc Mon Sep 17 00:00:00 2001 From: jzhao234 Date: Mon, 14 Sep 2026 20:25:31 +0000 Subject: [PATCH] fix(auth): add a Content-Security-Policy to every Explorer page TL;DR: Explorer pages now ship a Content-Security-Policy that lets only this origin's scripts plus the page's own nonced inline blocks run, allows styles only from this origin, and permits remote images because email bodies reference them. An injected script or event handler cannot execute even if some markup slips through. Problem: Explorer set X-Content-Type-Options, X-Frame-Options and Referrer-Policy but no CSP. It renders sanitized email bodies inline and holds a session cookie, which is exactly the page you want a script policy on. Auth got a nonce-based CSP in its first release; the applications did not. Fix: - security_headers middleware generates a per-response nonce, sets a page policy on text/html responses and a closed default-src 'none' policy on everything else. - Page policy: default-src 'self'; script-src 'self' plus the nonce; style-src 'self'; img-src 'self' data: https:; font-src and connect-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'. - The four inline -