brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.84k stars 2.33k forks source link

Page CSP breaks Element Picker #26686

Open Seirdy opened 1 year ago

Seirdy commented 1 year ago

Description

Several different CSP directives can cause different kinds of breakages in the Brave adblocker's element picker UI.

Steps to Reproduce

  1. Visit https://seirdy.one/meta/csp-bug-reproduction/
  2. Follow the steps on the page to re-produce the issue with four different Content-Security-Policy headers. Observe that the fetch directives on seirdy.one alone are enough to hide the rules box and turn the page blank. The sandbox directive without allow-scripts allow-same-origin renders the element-picker completely non-interactive.
  3. For comparison, test on https://grapheneos.org which allows scripts from self.

Reproduces how often:

Consistently reproduced.

Brave version (brave://version info)

1.47.55 Chromium: 107.0.5304.91 (Official Build) nightly (64-bit)

Version/Channel Information:

I've been encountering this issue for months, so it should be visible in the stable and beta channels too.

Miscellaneous Information:

For comparison:

Seirdy commented 1 year ago

Other functionality broken by page CSPs: https://github.com/brave/brave-browser/issues/24577