-
Notifications
You must be signed in to change notification settings - Fork 183
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
MPP-3786: More settings changes for dockerflow #4609
Conversation
Refactor CSP settings to be in one section, and in the order they appear in the Content-Security-Policy header. The 'unsafe-inline' directive is ignored if there are nonce or hash sources in the same directive. So, if we're using 'unsafe-inline', then don't compute or use the hashes for the style-src.
Allow the environment to silence more system checks, used by dockerflow for __heartbeat__. Ensure "models.W040" is included, even if not specified.
da0ebb5
to
6d78df4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not too familiar with CSP and this work, a secondary review might be helpful.
Did not run into any errors with these changes and confirmed that the inline-styles applied.
MPP-3786: More settings changes for dockerflow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes LGTM too!
Content-Security-Policy
(CSP) settings:_
for variables only used inprivaterelay/settings.py
FXA_BASE_ORIGIN
instead ofFXA_PROFILE_ENDPOINT
connect_src
'unsafe-inline'
is used for styles, do not include hashes instyle-src
. If they are included, browsers will ignoreunsafe-inline
.DJANGO_SECURE_SSL_REDIRECT
is converted to bool forSECURE_SSL_REDIRECT
SILENCED_SYSTEM_CHECKS
from the environmentHow to test
I pushed this branch to the dev server to test. With the proper environment settings, https://dev.fxprivaterelay.nonprod.cloudops.mozgcp.net/__heartbeat__ shows
{"status": "ok"}
, and no CSP issues on the dashboard or API docs.The CSP changes are targeted at local development and the dev server. The
/api/v1/docs
URL looks like this on main:With this PR, inline style is allowed, so there is a grey background applied:
For
/api/v1/docs/redoc
, the sidebar floats a little from the edge:With this PR, the sidebar hugs the edge: