-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add some initial CSP settings to test #527
base: master
Are you sure you want to change the base?
Conversation
This is currently breaking webclient quite badly:
Closing for now... |
After that change, I'm seeing errors like this on the login page:
Need to add quotes to |
With those changes, the webclient appears usable, but we're still seeing some errors in the Console:
From line
See https://stackoverflow.com/questions/54695310/getting-refused-to-create-worker-from-blob-error-in-video-min-js-when-looking "It means that you need explicitly add blob: data schema to default-src or worker-src""default-src * data: 'unsafe-eval' 'unsafe-inline' blob:"
Seems from https://stackoverflow.com/questions/18447970/content-security-policy-data-not-working-for-base64-images-in-chrome-28 that we need |
Still seeing Header:
Need to check on why...? |
Now seeing this
Not seeing any errors. @knabar is this something we want to progress with or put on hold for now until we feel more urgency for it? |
@will-moore This looks like a good starting point, no objections to including it into the next release with the appropriate warnings to developers that certain things might need extra configuration to keep them working. I initially thought that it could be better to have just one setting with a JSON struct for all CSP settings, but that would require more complex code to get the settings into the appropriate place in So 👍 from me |
As discussed just now, need to think about docs etc and possibility of breaking users' plugins / modifications - Is this a breaking change etc before merging... |
Possible issues:
cc: @sbesson @chris-allan |
Fixes #21.
Based initially on reading docs at https://django-csp.readthedocs.io/en/latest/configuration.html and reading
https://blog.sucuri.net/2023/04/how-to-set-up-a-content-security-policy-csp-in-3-steps.html
This picks a handful of the most common settings and adds them to
omeroweb.settings
allowing them to be configured, and using"'self'"
as the default value.To test - page shouldn't be able to load images, scripts etc from other domains.