Reputation: 34177
In Firefox I am getting the following error:
Content Security Policy: The page’s settings blocked the loading of a resource at data: (“media-src”).
I am unsure why I would get this error as I host no video or audio tags.
<add name="Content-Security-Policy" value="default-src 'self'; connect-src 'self'; font-src 'self'; frame-src 'self'; img-src 'self'; media-src 'self'; object-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';"/>
How can you find the source of the blocked resource in Firefox?
Any ideas why this would occur when the site has no external resources?
SOLUTION
I needed to include the data:
attribute.
media-src 'self' data:;
Upvotes: 3
Views: 2093
Reputation: 10439
FWIW, I have the same problem at my side with Firefox ESR (but not with Chrome). Each page (with just the appropriate CSP in header), even with an empty (thus 0 byte long) body, resulted in following ugly warning in the FF Console:
Content-Security-Policy: The page’s settings blocked the loading of a resource at data: (“default-src”).
The message disappears when the NoScript
extension is unloaded.
Disabling NoScript
on the TAB was not enough, it only vanished when I completely unloaded the extension from FF. Hence NoScript
extension - sadly - injects this warning into pages, which means that NoScript
leaks your privacy when it triggers a CSP report to websites and hence reveals its presence which can be used to do fingerprints (this only happens with pages with a very strict CSP, though).
When I tried to debug this, the received CSP report was not very conclusive at all:
{
"csp-report": {
"blocked-uri": "data",
"disposition": "enforce",
"document-uri": "https://survey.example.net/",
"effective-directive": "media-src",
"original-policy": "default-src 'none'; base-uri 'none'; form-action 'self'; script-src 'self'; img-src 'self'; style-src 'self'; connect-src 'self' https://forum.example.net/; frame-ancestors 'none'; report-uri https://login.example.net/csp",
"referrer": "",
"status-code": 200,
"violated-directive": "media-src"
}
}
Notes:
example
above.uBlock Origin
stops the CSP reports from being sendNoScript
installedNoScript
is a lifesaver against malicious sites and JavaScript
ublock-origin
to protect your privacyUpvotes: 2
Reputation: 8496
Basic ways to debug CSP:
report-uri
directive) can give full info.Detailed info how to debug CSP.
Upvotes: 2