: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): narrow the github sources in the app connect-src (#104905)
Tom Piccirello3c46d5bcc2d0
diff --git a/posthog/middleware.py b/posthog/middleware.pyindex 3e953c17fe23..b78126ee4ece 100644--- a/posthog/middleware.py+++ b/posthog/middleware.py@@ -1615,7 +1615,9 @@ class CSPMiddleware:# SQL editor all render blob URLs, so they lose their images without it.f"img-src 'self' data: blob: https: {resource_url} https://posthog.com https://www.gravatar.com https://res.cloudinary.com https://platform.slack-edge.com https://raw.githubusercontent.com",frame_ancestors,- f"connect-src 'self' https://www.posthogstatus.com {resource_url} {connect_debug_url} https://raw.githubusercontent.com https://api.github.com",+ # The live debugger's repo browser reads PostHog/posthog from the GitHub API. The path keeps+ # the rest of the API, and every other repository, out of reach of injected script.+ f"connect-src 'self' https://www.posthogstatus.com {resource_url} {connect_debug_url} https://api.github.com/repos/PostHog/posthog/",# https: lets heatmaps frame a customer's site. 'self' is for the replay player# frame, whose document is same-origin: an http origin does not match https:."frame-src 'self' https:",