Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pydotorg/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@

### Content Security Policy, via django-csp

# If this setting is unset, the default value of 'None'
# will mean that the report-uri directive is omitted
# in the Content-Security-Policy header.
_CSP_REPORT_URI = config("CSP_REPORT_URI", None)

# Django 6.0 ships built-in CSP support; drop django-csp and this setting
# and use the framework's own CSP once we upgrade.
# Report-Only first: collect violations and tune the allowlist before
Expand All @@ -316,6 +321,11 @@
"base-uri": ["'self'"],
"object-src": ["'none'"],
"form-action": ["'self'"],
"report-uri": [_CSP_REPORT_URI],
# When we upgrade to Django 6, begin using
# 'report-to' and 'Reporting-Endpoints' header.
# django-csp doesn't support automatically
# setting the HTTP headers required for this.
},
}

Expand Down