You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Default CSP has no worker-src directive; blocks MapLibre and any blob: Web Worker #93
SecurityHeadersMiddleware._DEFAULT_CSP (and the dev override in dev_csp(...)) doesn't set a worker-src directive, and CSP's fallback chain uses script-src for workers. Because script-src is 'self' 'unsafe-inline' 'unsafe-eval' (without blob:), every dependency that creates a Web Worker via URL.createObjectURL(blob) is blocked.
Repro
Mount any maplibre-gl map in a page rendered through the framework. The browser logs:
Refused to create a worker from 'blob:http://localhost:8001/<uuid>' because it
violates the following Content Security Policy directive: "script-src 'self'
'unsafe-inline' 'unsafe-eval' http://localhost:5051". Note that 'worker-src' was
not explicitly set, so 'script-src' is used as a fallback.
The map mounts but never paints (the worker handles tile decoding and source updates).
This isn't MapLibre-specific. Any library that ships a worker bundled as a blob (most modern WASM/canvas libs — comlink, web-tree-sitter, parquet-wasm, lighthouse-style, etc.) will hit the same wall.
Expected
The default CSP should add:
worker-src 'self' blob:
child-src 'self' blob:
(child-src is the legacy fallback some browser versions still consult before worker-src.)
blob: for workers is widely accepted as safe even in fairly strict CSPs — the bytes still come from same-origin code that already had script-execution privileges.
Closing — addressed by commit ade3e24 (PR #98). SecurityHeadersMiddleware._DEFAULT_CSP (and dev_csp) now include worker-src 'self' blob: and child-src 'self' blob:, so MapLibre and other blob-Worker libraries load without CSP violations and without monkey-patching.
Activity
fix: address framework papercuts (#66, #68, #71, #73, #75, #76, #81, #90
antosubash commentedon May 1, 2026
Closing — addressed by commit ade3e24 (PR #98).
SecurityHeadersMiddleware._DEFAULT_CSP(anddev_csp) now includeworker-src 'self' blob:andchild-src 'self' blob:, so MapLibre and other blob-Worker libraries load without CSP violations and without monkey-patching.Generated by Claude Code