"""Security headers, CSP and the JSON request log.""" from __future__ import annotations import logging import time from starlette.datastructures import MutableHeaders from starlette.types import ASGIApp, Message, Receive, Scope, Send def _policy(object_src: str) -> str: return "; ".join( [ "default-src 'self'", # The built bundle only: Vite emits no inline script, and pdf.js 6 needs no eval (wasm stays off). "script-src 'self'", # No 'unsafe-inline'. React style props and pdf.js set CSSOM properties, which CSP allows. The print # rules live in theme.css; pdf.js adds fonts through the FontFace API, not a