-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Content Security Policy error because of inline script #3816
Comments
Both options are not great:
What if we move it to its own file, but also move it to the body section? @ranbena |
(sorry for the typos) |
Relocating the script into Options:
Looks like option 2 is best. |
The nonce should be randomized on every request or otherwise it serves no purpose :) Is there some good reference on why having script tags is a security concern? |
Got the terms mixed up. I meant "hash-source"
More info here
I reckon it has to do with the risk of 3rd party modification like browser extensions. |
The |
Apparently, his feature (SRI) is only available for external file fetches. I'll attempt the 2nd option then. |
Thanks @ranbena! |
Issue Summary
@ranbena @arikfr The change in #3609 leads to a Content Security Policy error when loading any page:
Chrome:
Firefox:
I don't think we should add
unsafe-inline
to thescript-src
directive but instead indeed provide a per-request nonce in the formatFlask-Talisman supports rendering a random nonce like shown in the example here . Sadly we can't just not apply CSP since the templates are used on every page, if I understand correctly.
Right now
multi_org.html
is the only one that is rendered via Jinja2, but I think it's safe to do that forindex.html
, right?Alternatively, would it suffice to move the
<script>
block into an own script that we can load instead?Can you think of a way to fix this?
Steps to Reproduce
Technical details:
The text was updated successfully, but these errors were encountered: