Skip to content

Commit

Permalink
Add settings for enabling CSP to config file (#2134)
Browse files Browse the repository at this point in the history
* add enabling csp to config file

* comment out report URI to avoid breaking self-hosted
  • Loading branch information
hubertdeng123 committed May 10, 2023
1 parent d8b1432 commit 25f10ea
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sentry/sentry.conf.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,16 @@ def get_internal_network():

if OPENAI_API_KEY:
SENTRY_FEATURES["organizations:open-ai-suggestion"] = True

##############################################
# Content Security Policy settings
##############################################

if "csp.middleware.CSPMiddleware" not in MIDDLEWARE:
MIDDLEWARE = ("csp.middleware.CSPMiddleware",) + MIDDLEWARE
# CSP_REPORT_URI = "https://{your-sentry-installation}/api/{csp-project}/security/?sentry_key={sentry-key}"
CSP_REPORT_ONLY = True

# optional extra permissions
# https://django-csp.readthedocs.io/en/latest/configuration.html
# CSP_SCRIPT_SRC += ["example.com"]

0 comments on commit 25f10ea

Please sign in to comment.