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

hashed unsafe-inline support? #67

Open
jamesarosen opened this issue Jul 8, 2016 · 4 comments
Open

hashed unsafe-inline support? #67

jamesarosen opened this issue Jul 8, 2016 · 4 comments

Comments

@jamesarosen
Copy link

jamesarosen commented Jul 8, 2016

unsafe-inline isn't sufficient to allow <script>...</script> on the page. CSP 2 requires those tags to have a hash of their contents. See https://www.w3.org/TR/2015/CR-CSP2-20150721/#script-src-hash-usage

Is there a way for this library to automatically calculate the hashes? Or should addons that use contentFor do the hashing and add the results to config.contentSecurityPolicy['script-src']? If the latter, could this addon expose an API to make that easier?

See also pgrippi/ember-cli-google-analytics#21

@sandstrom
Copy link
Collaborator

Thanks for bringing this up James!

At the moment no, but I agree that it would be a good addition.

For hashes we'd need to have this addon run after minification. Do you know if ember-cli has support for specifying the order of addons?

I don't know much about addon <-> addon communication, but unless there is a way of specifying the order it would be better if this addon had an API for setting the hash.


Nonces (https://www.w3.org/TR/2015/CR-CSP2-20150721/#script-src-nonce-usage) would be easier to implement, but won't work since they must be randomly generated for each request (ember is often hosted statically).

@jelhan
Copy link
Collaborator

jelhan commented Jun 10, 2019

This is also a requirement for ember-style-modifier to support SSR/Fastboot: jelhan/ember-style-modifier#11 Please especially note the design outlined in jelhan/ember-style-modifier#11 (comment). I'm planing to implement that feature soon.

@GCheung55
Copy link

GCheung55 commented Jul 28, 2020

Any update on this issue? It would be really helpful to have a way to add hashes to the configuration at build time.

@jelhan
Copy link
Collaborator

jelhan commented Jul 28, 2020

It's still a work in progress. But slow progress to be honest. v2 should lay the foundation for this feature. I hope that implementation is straight forward afterwards. But I don't have much time to work on this addon currently. So it will take some time.

I would appreciate any help. If you have some time to help implementing this feature or the missing pieces to get v2 stable, please reach out to me on Discord to coordinate.

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

4 participants