:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(csp): allow WebAssembly compilation (#95356)
Tom Piccirello5313277412cc
diff --git a/posthog/middleware.py b/posthog/middleware.pyindex 949f29c7ca2e..beac0d9d5171 100644--- a/posthog/middleware.py+++ b/posthog/middleware.py@@ -1212,7 +1212,13 @@ class CSPMiddleware:csp_parts = ["default-src 'self'",f"style-src 'self' 'unsafe-inline' {resource_url} https://fonts.googleapis.com",- f"script-src 'self' 'nonce-{nonce}' {resource_url} https://*.i.posthog.com",+ # 'wasm-unsafe-eval' permits WebAssembly compilation and nothing else. It is not+ # 'unsafe-eval': it does not permit eval() or the Function constructor. Compiling a+ # module still requires calling WebAssembly.instantiate from JavaScript, so it grants+ # nothing to an attacker who cannot already run script, and nothing further to one who+ # can. Session replay decompresses snapshots with snappy-wasm and the HogQL editor+ # parses with a WebAssembly build, so both break without it.+ f"script-src 'self' 'nonce-{nonce}' 'wasm-unsafe-eval' {resource_url} https://*.i.posthog.com",f"font-src 'self' {resource_url} https://app-static.eu.posthog.com https://app-static-prod.posthog.com https://fonts.gstatic.com https://cdn.jsdelivr.net","worker-src 'self'","child-src 'none'",