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

Provide options for ScriptInjector/CssResource/GssResource to work with CSP headers #9990

Open
niloc132 opened this issue Jul 31, 2024 · 0 comments

Comments

@niloc132
Copy link
Contributor

CssResource/GssResource inject their contents inline into <style> tags using the StyleInjector, and do not presently have any accommodation for CSP rules - that is, if CSP is enabled, unsafe-inline/etc must be specified for this to still work.

In theory, we could hash all of the included CssResource blobs of content, and provide them in a generated file, so that a server can provide them and indicate that those inline styles are safe because they match an expected hash. We could also offer a way to pass in a nonce, so that each style tag when created would have a supported nonce for that page load - though I'm a little skeptical of how this would actually be safe if the value is readable by plain JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant