el1t / uBlock-Safari

uBlock Origin - An efficient blocker for Chromium, Firefox, and Safari. Fast and lean.
GNU General Public License v3.0
2.75k stars 98 forks source link

CSP violation with script-src: 'self' #127

Open Synchro opened 6 years ago

Synchro commented 6 years ago

Prerequisites

Description

uBO causes a CSP violation on page load when I have a CSP containing script-src: 'self'. The problem still occurs when uBO is the only extension loaded and is "disabled" via the big button. I have no filters set.

This appears to be Safari-specific: I can't reproduce it in Chrome.

A specific URL where the issue occurs

https://www.smartmessages.net/login.php

Steps to Reproduce

  1. Open the console, enable stop on all exceptions
  2. Visit https://www.smartmessages.net/login.php
  3. Observe the uncaught exception with this call stack:

image

It breaks on line 612 of vapi-client.js:

document.documentElement.removeChild(document.documentElement.appendChild(tmpJS));

It's breaking on my CSP, which contains script-src: 'self'; all my scripts are external, no unsafe-inline or unsafe-eval scripts are allowed.

If I disable uBO altogether, the error does not occur.

Expected behavior:

uBlock avoids tripping this CSP rule.

Actual behavior:

uBlock trips this CSP rule.

Your environment