-
Notifications
You must be signed in to change notification settings - Fork 29
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 hashes problem #220
Comments
IMHO the current workaround is to disable htmlnano's built-in Calculating new SRI in |
Why risky? |
If the Although So IMHO, if you do trust htmlnano, you should generate SRI after htmlnano modify the I will create a PR to let htmlnano skips |
Good points! I agree with @SukkaW. |
fix(#220): skip <script> and <style> with SRI
I'm using Content Security Policy to increase security and Lighthouse score.
I'm using many frameworks which generate html files like:
When I use
htmlnano
on it the<script></script>
content obviously changes (is minified too along with html) and I get CSP errors like:Refused to execute inline script because it violates the following Content Security Policy directive: "script-src domain.com 'sha256-fXiuOGTc9r/EgsIAcDthKaYGYUT3svq8f4NzsIwFHmE=' 'sha256-Vn0EF4j1eAcb5cTHq3jjTvL32M3ijgVackLAvIuZg9Q='". Either the 'unsafe-inline' keyword, a hash ('sha256-tcp8uK2Psib07uQY3U6+vLDwwqjQkUhn8M7KfM61Fg4='), or a nonce ('nonce-...') is required to enable inline execution.
because no generated (before htmlnano launch) hash matches.
I think htmlnano should re-calculate and change those sha256 values.
What do you think?
The text was updated successfully, but these errors were encountered: