Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop superfluous CSP (+report object-src) #14897

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 3 additions & 6 deletions bedrock/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,12 @@
_csp_script_src = [
# TODO fix use of OptanonWrapper() so that we don't need this
csp.constants.UNSAFE_INLINE,
# TODO onetrust cookie consent breaks
# blocked without unsafe-eval. Find a way to remove that.
"www.mozilla.org",
# TODO onetrust cookie consent needs this, explore ways of fixing
csp.constants.UNSAFE_EVAL,
"www.googletagmanager.com",
"www.google-analytics.com",
"cdn.cookielaw.org",
"assets.getpocket.com", # allow Pocket Snowplow analytics
"www.mozilla.org",
]
_csp_style_src = [
csp.constants.UNSAFE_INLINE,
Expand All @@ -154,7 +152,6 @@
"o1069899.ingest.sentry.io",
"cdn.cookielaw.org",
"privacyportal.onetrust.com",
"getpocket.com", # Pocket Snowplow
"geolocation.onetrust.com",
]
_csp_connect_extra_for_dev = [
Expand All @@ -175,7 +172,6 @@
]
_csp_img_src = [
"data:",
"mozilla.org",
"www.googletagmanager.com",
"www.google-analytics.com",
"creativecommons.org",
Expand Down Expand Up @@ -269,6 +265,7 @@
CONTENT_SECURITY_POLICY_REPORT_ONLY["DIRECTIVES"]["report-uri"] = csp_report_uri
# CSP directive updates we're testing that we hope to move to the enforced policy.
CONTENT_SECURITY_POLICY_REPORT_ONLY["DIRECTIVES"]["frame-ancestors"] = [csp.constants.NONE]
CONTENT_SECURITY_POLICY_REPORT_ONLY["DIRECTIVES"]["object-src"] = [csp.constants.NONE]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also a little tempted to test-drive restricting default-src to just self? (Instead of all the default wildcards)

Suggested change
CONTENT_SECURITY_POLICY_REPORT_ONLY["DIRECTIVES"]["object-src"] = [csp.constants.NONE]
CONTENT_SECURITY_POLICY_REPORT_ONLY["DIRECTIVES"]["object-src"] = [csp.constants.NONE]
CONTENT_SECURITY_POLICY_REPORT_ONLY["DIRECTIVES"]["default-src"] = [csp.constants.SELF]

CONTENT_SECURITY_POLICY_REPORT_ONLY["DIRECTIVES"]["style-src"].remove(csp.constants.UNSAFE_INLINE)


Expand Down