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.

chore(csp): report on cross-origin form posts (#94387)

Tom Piccirelloa53ac65b625e
diff --git a/posthog/middleware.py b/posthog/middleware.py
index cd3c3ad8bb85..ee07129a479a 100644
--- a/posthog/middleware.py
+++ b/posthog/middleware.py
@@ -1225,6 +1225,9 @@ class CSPMiddleware:
"frame-src https:",
"manifest-src 'self'",
"base-uri 'self'",
+ # form-action has no default-src fallback, so leaving it unset lets an injected
+ # form post anywhere. Every form we serve targets a same-origin path.
+ "form-action 'self'",
]
report_uri = csp_report_endpoint(sample_rate="0.1")