: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
fix(csp): allow data: URL fonts and drop an unused CDN origin (#99477)
Tom Piccirello18b824b7932a
diff --git a/posthog/middleware.py b/posthog/middleware.pyindex 6480f4026793..b073d1fe600f 100644--- a/posthog/middleware.py+++ b/posthog/middleware.py@@ -1326,7 +1326,12 @@ class CSPMiddleware:# 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",+ # A data: font cannot execute script, and this directive governs font loading only,+ # so the token widens nothing else. It also carries nothing out: a data: URL makes+ # no request, which is what the CSS-injection attacks on this directive need. The+ # `data:` refusal in the worker-src note below is a different case, because a+ # worker body is code.+ f"font-src 'self' data: {resource_url} https://app-static.eu.posthog.com https://app-static-prod.posthog.com https://fonts.gstatic.com",# `blob:` grants nothing to an attacker who cannot already run script, because only# script can mint a blob URL, and a worker started from one inherits this policy# rather than escaping it. The ServiceWorker spec rejects `blob:` on its own, so