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

Crate not working with Content Security Policy #13

Closed
mateesville93 opened this issue Oct 9, 2020 · 2 comments
Closed

Crate not working with Content Security Policy #13

mateesville93 opened this issue Oct 9, 2020 · 2 comments

Comments

@mateesville93
Copy link

Hi, I'm trying to add crate to my site and CSP is blocking the script because it uses eval()
It will be nice if you can remove eval() from the script.

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive

eval() - JavaScript MDN

@Yomanz
Copy link
Member

Yomanz commented Oct 15, 2020

You should be able to use no-eval in the crate script tag.

Open the issue again if that doesn't fix it.

@Yomanz Yomanz closed this as completed Oct 15, 2020
@CxRes
Copy link

CxRes commented Aug 8, 2022

I am still having CSP issue with the introduction of a style tag.

crate.js:formatted:13642 
Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='), or a nonce ('nonce-...') is required to enable inline execution.

Can you please suggest a way to avoid this (other than unsafe-inline). Or do you need to refactor code or introduce a new CSP policy?

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

3 participants