Closed roryprimrose closed 7 years ago
Is there any way to get more info on what exactly in the script is causing this warning? Not sure about the rest of the team but I'm not familiar with CSP, so unsure exactly how one would go about debugging this.
What happens if you remove the application insights script/vue plugin. Does the warning still show?
It's because v-list-tile
s are anchor tags with href="javascript:;"
, which isn't allowed to run without unsafe-inline
being enabled.
Yeah, that would definitely break CSP. The reason that the CSP enforce doesn't break the functionality here is because the script in itself is a no-op.
Why is an anchor used for that component if there is no navigation?
There is an interesting option found in this SO comment - https://stackoverflow.com/a/22530755/369962
Ran into the same problem. You can spin up a webserver and add a strict CSP with everything disallowed except 'self'
. So a HTTP header like Content-Security-Policy: default-src 'self' data:;
See https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP#Examples_Common_use_cases
Steps to reproduce
script-src 'self' https://az416426.vo.msecnd.net/scripts/a/ai.0.js;
Browser reports
CSP report payload
Versions
Chrome 62, Windows 10
What is expected ?
Selecting an option should not violate a CSP.
What is actually happening ?
Selecting an option appears to be trying to execute a JavaScript url.
The enforced CSP failure does not prevent the select from operating as expected.
Reproduction Link
I can't use a codepen to produce this because it requires the server to provide the CSP in response headers. You can see this in action at https://techmentorwebdev.azurewebsites.net which uses v-select components on the home page.