Closed nmschulte closed 6 years ago
It's not a Content-Security-Policy
, it's a Content-Security-Policy-Report-Only
, it has not effect except for allowing uMatrix to know when a web page tries to use a web worker.
To clarify, you're stating that I'm simply mis-interpreting these "[Report Only]" error messages as errors, when really they're just notices (of would-be errors), and the browser actually does allow and create the workers?
you're stating that I'm simply mis-interpreting these "[Report Only]" error messages as errors
Yes, because you said:
leaves behind a Content-Security-Policy that interferes with my application.
They are report-only CSP directives, they can't interfere with your application. If you do not want the csp-report, see https://github.com/gorhill/uMatrix/wiki/Raw-settings#disablecspreportinjection.
@gorhill Thank you.
Is it conceivable, sensible, to disable the CSP Report injection if there's an enabled matrix-off
rule for a domain/host?
The purpose is for uMatrix to be able to report that web workers are used on a site. Without this CSP reports, it's not possible to inform about this. Such information is key in deciding what rules should apply to a site.
Understood. Given that this (CSP Report injection) is only here to workaround a bug, it's low priority anyway.
My rationale is this: matrix-off
is like a "disable uMatrix extension for this domain/host," so there's no need to check for web workers, let alone enforce any uMatrix rules.
matrix-off
is like a "disable uMatrix extension for this domain/host
It's not:
The per-scope switches are independent from the matrix filtering switch, meaning that if you toggle off matrix filtering, the per-scope switches which are toggled on will still apply. For example, one could turn off matrix filtering while keeping the ability to forbid mixed content.
If a site is mining coins, you want to know about this, regardless of the state of uMatrix, and arguably even more so if one disabled all parts of uMatrix.
for allowing uMatrix to know when a web page tries to use a web worker
@gorhill, does it mean that there is no way to avoid seeing this [Report Only]
message?
As said above, see https://github.com/gorhill/uMatrix/wiki/Raw-settings#disablecspreportinjection.
@gorhill, oh crap, my bad. I didn't word my question correctly.
I mean if I go through disableCSPReportInjection
I'll disable a part of functionality of uMatrix. Is there any other way to keep the plugin monitoring workers but avoid this warning? I'm talking about my web server where I can control Headers.
E.g. any chance that setting Content-Security-Policy-Report-Only
headers form the server will suppress the [Report Only]
warning? Or it is an inevitable consequence of uMatrix working as designed?
It does not matter who set the content security policy, the browser will always output violations at the console.
Ah, I see that the CSP spec has no support for blacklisting, hence the need for a global/always-on worker-src: none
report-only CSP.
Would it be possible to maintain the policy/whitelist in real-time / per-request/domain, and refuse to add domains with no-worker: true
rules?
This would prevent CSP reports for whitelisted domains, which is what caught my attention initially.
This would prevent CSP reports for whitelisted domains
As already pointed out, the report is needed to inform about use of workers. Not blocking workers on a domain is not equivalent to "don't tell me if workers are being used" on this domain. Information about whether workers are used is key in deciding on whether to block or allow them.
As already pointed out, the report is needed to inform about use of workers.
chicken / egg. got it. thanks for sticking with me.
Visiting a locally hosted document which makes use of web workers (served by the same host).
http://localhost:3000/
.Disabling uMatrix (via the power button, disabling the two "forbid ..." and the two "spoof ..." options, and reloading w/out browser cache) still leaves behind a Content-Security-Policy that interferes with my application.
In Chrome (Chromium
Version 61.0.3163.100 (Developer Build) built on Debian buster/sid, running on Debian buster/sid (64-bit)
), I receive aworker-src 'none'
violation:In Firefox (
57.0.4 (64-bit)
), I receive achild-src 'none'
violation:Additionally, Firefox complains about these aspects of CSP when viewing the document:
The only way I can get around this is to disable uMatrix at the extension/add-on level. No matter of twiddling with the rules or adding my own CSP HTTP headers or HTML meta tags to allow the workers/etc. suffices.