-
Notifications
You must be signed in to change notification settings - Fork 46
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
CSP with commas are parsed in a confusing way #10
Comments
Thank you for reporting Brian. For simple cases like the one you posted above, you can evaluate policies individually and manually intersect results. |
There are multiple aspects of this, some of which are easier to fix than others:
|
Consider the input:
That passes the evaluator just fine, with no warnings.
Now, consider this stronger combination of two policies:
The intent of this second input is to require that a script be loaded from
self
AND match the given hash, if the browser supports CSP hash, by asking for the intersection of two policies. This is a stronger policy than the original policy. However, the evaluator complains that "'self' can be problematic if you host JSONP, Angular or user uploaded files" because it doesn't notice thescript-src
. It also complains about thestyle-src
directive because it doesn't recognize the comma that separates the two policies.Ideally, the evaluator should be extended to understand multiple policies joined using
,
.This example uses CSP hash, which is rare. However, I believe several people have advocated for a similar technique of combining multiple policies that uses CSP nonce instead of CSP hash, so it would be good to support this pattern.
The text was updated successfully, but these errors were encountered: