Skip to content

: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.

fix(csp): allow our own media in the app policy (#99571)

Tom Piccirellof087c5e4bd69
diff --git a/posthog/middleware.py b/posthog/middleware.py
index b073d1fe600f..205153de2de0 100644
--- a/posthog/middleware.py
+++ b/posthog/middleware.py
@@ -1349,7 +1349,11 @@ class CSPMiddleware:
"worker-src 'self' blob:",
"child-src 'none'",
"object-src 'none'",
- "media-src https://res.cloudinary.com",
+ # `'self'` carries the PostHog AI onboarding videos under /static/. Max hands-free
+ # needs the other two: it primes playback with a silent `data:` clip, then plays
+ # the TTS response from a blob URL. None of the three can execute, because
+ # media-src governs <audio> and <video> only.
+ "media-src 'self' data: blob: https://res.cloudinary.com",
# `https:` is here for the OAuth authorize page, which renders an application's icon
# from a URL its registrant supplied. There is no allowlist that covers those, so
# until we serve them ourselves the directive has to accept any host.