-
Notifications
You must be signed in to change notification settings - Fork 15
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
Incorrect hashes being generated for styles and src? #18
Comments
Same... |
Tracked it down to these two divs Gatsby wraps the body with: If you calculate the sha-256 for those two styles, you'll see they match the ones in the browser error i.e. This plugin only calculates the sha-256 on |
As a work around for the style attributes on (unsafe-hashes option is required in some browsers to make it work for style attributes) Note that if a future Gatsby update changes the style attribute on these divs these hashes would need to be updated again. Also make sure you have Full example:
|
I'm not clear on where this sha key should come from? |
@potatowave check the console CSP error/warning in the browser after a deployment and it will say hash was provided but was expected. Then just change it to <2>. That's how I did it. In my case it looked like this: |
Love this plugin, went from "what is CSP" to it's working in like 2 hours.
However I only got it working with the insecure directives:
I would like to get it working with the script and style hashes, but it seems that the generated hashes are not correct? When I have these options:
I see an error that implies incorrect hashing:
similar message for styles
Any ideas what I may be doing incorrect? Doesn't work in development nor production.
The text was updated successfully, but these errors were encountered: