You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering difficulties loading local stylesheets using the style-src-elem directive without including self as a source when using default-src 'none'.
Here is a simple example of the issue:
<linkrel="stylesheet" href="style.css">
This setup fails to load when using the following CSP configuration:
From the spec, only the script matching algorithm includes "Does integrity metadata match source list?", so the spec would need a change to also permit external style resources by integrity hash.
The hash for external scripts is only checked if the <script> element includes an integrity attribute.
I am encountering difficulties loading local stylesheets using the
style-src-elem
directive without includingself
as a source when usingdefault-src 'none'
.Here is a simple example of the issue:
This setup fails to load when using the following CSP configuration:
I have tried adding the integrity attribute, but it did not resolve the issue.
I tested with both Chrome and Firefox and encountered the same issue on both. The stylesheet gets blocked due to CSP violations.
Is it possible to load a local stylesheet without whitelisting 'self' as a source? Of so, what am i missing in my configuration?
I have set up a repository that replicates this behavior for testing:
https://github.com/nizos/csp-docker
Any guidance or clarification on whether this is expected behavior according to the CSP spec is greatly appreciated.
Thanks in advance!
The text was updated successfully, but these errors were encountered: