Skip to content
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

Block moz-extension CSP reports #2892

Merged
merged 1 commit into from
Apr 12, 2023
Merged

Block moz-extension CSP reports #2892

merged 1 commit into from
Apr 12, 2023

Conversation

ghostwords
Copy link
Member

@ghostwords ghostwords commented Apr 7, 2023

Fixes a part of #1793.

Although this blocks all source-file: "moz-extension" CSP reports, we still have the issue of some of our scripts being blocked by page CSPs in Firefox.

Note that script surrogates are no longer subject to page CSPs (#2801).

DDG's test page: https://privacy-test-pages.glitch.me/security/csp-report/index.html

What does still get broken by page CSPs in Firefox?

Anything injected into page-level contexts ("main world"). So, navigator.doNotTrack, canvas fp. detection, document.cookie/localStorage blocking, ...

if your extension injects a (dynamically generated or static) inline script

https://bugzilla.mozilla.org/show_bug.cgi?id=1588957#c13

Are there any MV2 workarounds?

Yes, inject page scripts from web_accessible_resources or via "Xray vision" instead.

https://bugzilla.mozilla.org/show_bug.cgi?id=1591983#c1

How will this change with MV3?

TBD

}, ["blocking"]);
}, ['blocking']);

if (utils.hasOwn(chrome.webRequest.OnBeforeRequestOptions, 'REQUESTBODY')) {
Copy link
Member Author

@ghostwords ghostwords Apr 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't register in Chrome because lol it's REQUEST_BODY there, but ... Should we have a more robust check? The check needs to be synchronous though, to keep the listener "persistent" (#2882).

@JulienPalard
Copy link

I'm not able to proofread the implementation, but the idea of blocking CSP reports on moz-extensions make a lot of sense to me:

  • It prevents the reports to be used to fingerprint users or whatever stats can be done with them.
  • It avoid flooding website admins with reports that are unrelated with said site (no we won't ask our users to uninstall Privacy Badger just so we don't get reports, I'm a big fan of the extension myself to the point I recommend it on my pet project here: https://www.hackinscience.org/about/ ♥).

@ghostwords ghostwords force-pushed the block-moz-csp-reports branch from 1481253 to cff7c7d Compare April 11, 2023 21:49
@ghostwords ghostwords force-pushed the block-moz-csp-reports branch from cff7c7d to da8077c Compare April 12, 2023 13:13
@ghostwords ghostwords merged commit fc54da0 into master Apr 12, 2023
@ghostwords ghostwords deleted the block-moz-csp-reports branch April 12, 2023 17:57
ghostwords added a commit that referenced this pull request Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants