Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Don't add csp-headers if none are required#21318
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
stof commentedJan 17, 2017
This isnot a bug. |
arjenm commentedJan 17, 2017
Ok, it doesn't really matter for my PR anyway, so I scratched that. Thanks for correcting me :) |
romainneutron commentedJan 17, 2017
LGTM 👍 |
fabpot commentedJan 17, 2017
Thank you@arjenm. |
This PR was merged into the 3.2 branch.Discussion----------Don't add csp-headers if none are required| Q | A| ------------- | ---| Branch? | 3.2| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | This PR is also the ticket| License | MITIn 3.2 a tool to adjust Content Security Policy headers in combination with the WebProfiler was added. We encountered a bug in its behavior.We had CSP-headers that did not have a script-src/style-src nor a default-src (it was something like `form-action: https:`). In that scenario, the ContentSecurityPolicyHandler would add `script-src: 'unsafe-inline' 'nonce-....'`, but that would actually change the "everything is allowed scenario" into "only inline and nonce-... is allowed". The result was _only_ the javascript of WebProfiler was allowed, rather than everything.This PR fixes the scenario where no default-src nor a script-src/style-src is provided. It simply continue's rather than treats it as an empty list of rules that need additional rules.~A bug I did find, but not fix, is the fact that that `'unsafe-inline'` is ignored in at least Firefox and Chrome due to the fact there is also a nonce-element in the rule.~Commits-------6fecc94 Don't add csp-headers if none are required
Uh oh!
There was an error while loading.Please reload this page.
In 3.2 a tool to adjust Content Security Policy headers in combination with the WebProfiler was added. We encountered a bug in its behavior.
We had CSP-headers that did not have a script-src/style-src nor a default-src (it was something like
form-action: https:). In that scenario, the ContentSecurityPolicyHandler would addscript-src: 'unsafe-inline' 'nonce-....', but that would actually change the "everything is allowed scenario" into "only inline and nonce-... is allowed". The result wasonly the javascript of WebProfiler was allowed, rather than everything.This PR fixes the scenario where no default-src nor a script-src/style-src is provided. It simply continue's rather than treats it as an empty list of rules that need additional rules.
A bug I did find, but not fix, is the fact that that'unsafe-inline'is ignored in at least Firefox and Chrome due to the fact there is also a nonce-element in the rule.