Skip to content

Commit 25f10ea

Browse files
Add settings for enabling CSP to config file (#2134)
* add enabling csp to config file * comment out report URI to avoid breaking self-hosted
1 parent d8b1432 commit 25f10ea

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sentry/sentry.conf.example.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,16 @@ def get_internal_network():
306306

307307
if OPENAI_API_KEY:
308308
SENTRY_FEATURES["organizations:open-ai-suggestion"] = True
309+
310+
##############################################
311+
# Content Security Policy settings
312+
##############################################
313+
314+
if "csp.middleware.CSPMiddleware" not in MIDDLEWARE:
315+
MIDDLEWARE = ("csp.middleware.CSPMiddleware",) + MIDDLEWARE
316+
# CSP_REPORT_URI = "https://{your-sentry-installation}/api/{csp-project}/security/?sentry_key={sentry-key}"
317+
CSP_REPORT_ONLY = True
318+
319+
# optional extra permissions
320+
# https://django-csp.readthedocs.io/en/latest/configuration.html
321+
# CSP_SCRIPT_SRC += ["example.com"]

0 commit comments

Comments
 (0)