@@ -143,20 +143,22 @@ permissions_policy = "geolocation=(), microphone=()"
143143Hadrian ships a default CSP tailored for the web UI's frontend tools (Python, JavaScript, SQL, and chart execution via WASM):
144144
145145```
146- default-src 'self'; script-src 'self' blob:; style-src 'self' 'unsafe-inline';
147- img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self';
148- worker-src 'self' blob:; frame-src 'self' blob:; object-src 'none'; base-uri 'self'
146+ default-src 'self'; script-src 'self' blob: 'unsafe-eval' https://cdn.jsdelivr.net;
147+ style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:;
148+ connect-src 'self' https://cdn.jsdelivr.net; worker-src 'self' blob:;
149+ frame-src 'self' blob:; object-src 'none'; base-uri 'self'
149150```
150151
151- | Directive | Value | Reason |
152- | ------------ | ------------------------ | ---------------------------------------------------------------- |
153- | ` script-src ` | ` 'self' blob: ` | WASM workers (Pyodide, QuickJS, DuckDB) are loaded as blob URLs. |
154- | ` style-src ` | ` 'self' 'unsafe-inline' ` | Tailwind CSS injects styles dynamically. |
155- | ` worker-src ` | ` 'self' blob: ` | Web Workers run sandboxed code execution. |
156- | ` frame-src ` | ` 'self' blob: ` | HTML artifact previews render in sandboxed iframes. |
157- | ` img-src ` | ` 'self' data: blob: ` | Generated charts and inline images use data/blob URIs. |
158- | ` object-src ` | ` 'none' ` | Blocks plugin-based content (Flash, Java applets). |
159- | ` base-uri ` | ` 'self' ` | Prevents ` <base> ` tag injection attacks. |
152+ | Directive | Value | Reason |
153+ | ------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
154+ | ` script-src ` | ` 'self' blob: 'unsafe-eval' https://cdn.jsdelivr.net ` | WASM workers as blob URLs; ` unsafe-eval ` for Pyodide Python bytecode execution; CDN for Pyodide modules. |
155+ | ` style-src ` | ` 'self' 'unsafe-inline' ` | Tailwind CSS injects styles dynamically. |
156+ | ` worker-src ` | ` 'self' blob: ` | Web Workers run sandboxed code execution. |
157+ | ` frame-src ` | ` 'self' blob: ` | HTML artifact previews render in sandboxed iframes. |
158+ | ` img-src ` | ` 'self' data: blob: ` | Generated charts and inline images use data/blob URIs. |
159+ | ` connect-src ` | ` 'self' https://cdn.jsdelivr.net ` | Pyodide fetches WASM binaries and packages from CDN. |
160+ | ` object-src ` | ` 'none' ` | Blocks plugin-based content (Flash, Java applets). |
161+ | ` base-uri ` | ` 'self' ` | Prevents ` <base> ` tag injection attacks. |
160162
161163Override this by setting ` content_security_policy ` explicitly. Set to an empty string to disable the CSP header entirely.
162164
0 commit comments