Skip to content

Commit

Permalink
Merge pull request gorhill#12 from gorhill/master
Browse files Browse the repository at this point in the history
Re-sync with uBo master
  • Loading branch information
ryanbr committed Jul 13, 2020
2 parents bb10077 + ba0d4f8 commit 839ea16
Show file tree
Hide file tree
Showing 32 changed files with 1,608 additions and 940 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ uBlock Origin

**An efficient blocker add-on for various browsers. Fast, potent, and lean.**

uBlock Origin is **NOT** an "ad blocker": [it is a wide-spectrum blocker](https://github.com/gorhill/uBlock/wiki/Blocking-mode) -- which happens to be able to function as a mere "ad blocker". The default behavior of uBlock Origin when newly installed is to block ads, trackers and malware sites -- through [_EasyList_](https://easylist.github.io/#easylist), [_EasyPrivacy_](https://easylist.github.io/#easyprivacy), [_Peter Lowe’s ad/tracking/malware servers_](https://pgl.yoyo.org/adservers/policy.php), various lists of [malware](http://www.malwaredomainlist.com/) [sites](http://www.malwaredomains.com/), and uBlock Origin's [own filter lists](https://github.com/uBlockOrigin/uAssets/tree/master/filters).
uBlock Origin is **NOT** an "ad blocker": [it is a wide-spectrum blocker](https://github.com/gorhill/uBlock/wiki/Blocking-mode) -- which happens to be able to function as a mere "ad blocker". The default behavior of uBlock Origin when newly installed is to block ads, trackers and malware sites -- through [_EasyList_](https://easylist.github.io/#easylist), [_EasyPrivacy_](https://easylist.github.io/#easyprivacy), [_Peter Lowe’s ad/tracking/malware servers_](https://pgl.yoyo.org/adservers/policy.php), [_Online Malicious URL Blocklist_](https://gitlab.com/curben/urlhaus-filter#urlhaus-malicious-url-blocklist), and uBlock Origin's [own filter lists](https://github.com/uBlockOrigin/uAssets/tree/master/filters).

* [Documentation](#documentation)
* [Purpose & General Info](#philosophy)
Expand Down Expand Up @@ -67,7 +67,7 @@ That said, it's important to note that using a blocker is **NOT** [theft](https:

Ads, "unintrusive" or not, are just the visible portions of privacy-invading apparatus entering your browser when you visit most sites nowadays. **uBlock Origin's main goal is to help users neutralize such privacy-invading apparatus** — in a way that welcomes those users who don't wish to use more technical, involved means (such as [uMatrix](https://github.com/gorhill/uMatrix)).

_EasyList_, _Peter Lowe's Adservers_, _EasyPrivacy_ and _Malware domains_ are enabled by default when you install uBlock Origin. Many more lists are readily available to block trackers, analytics, and more. Hosts files are also supported.
_EasyList_, _EasyPrivacy_, _Peter Lowe's_, _Online Malicious URL Blocklist_ and uBO's own lists are enabled by default when you install uBlock Origin. Many more lists are readily available to block trackers, analytics, and more. Hosts files are also supported.

Once you install uBlock Origin, you may easily un-select any of the pre-selected filter lists if you think uBlock Origin blocks too much. For reference, Adblock Plus installs with only _EasyList_ enabled by default.

Expand Down
36 changes: 11 additions & 25 deletions assets/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
"assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat"
]
},
"ublock-resources": {
"content": "internal",
"updateAfter": 7,
"contentURL": "assets/ublock/resources.txt"
},
"ublock-filters": {
"content": "filters",
"group": "default",
Expand Down Expand Up @@ -139,30 +134,21 @@
"contentURL": "https://www.fanboy.co.nz/enhancedstats.txt",
"supportURL": "https://github.com/ryanbr/fanboy-adblock/issues"
},
"malware-0": {
"urlhaus-1": {
"content": "filters",
"group": "malware",
"title": "Malware Domain List",
"title": "Online Malicious URL Blocklist",
"contentURL": [
"https://gitcdn.xyz/repo/NanoMeow/MDLMirror/master/hosts.txt",
"https://raw.githubusercontent.com/NanoMeow/MDLMirror/master/hosts.txt",
"https://www.malwaredomainlist.com/hostslist/hosts.txt",
"https://gitcdn.xyz/repo/NanoMeow/MDLMirror/master/filter.txt",
"https://raw.githubusercontent.com/NanoMeow/MDLMirror/master/filter.txt",
"assets/thirdparties/www.malwaredomainlist.com/hostslist/hosts.txt"
]
},
"malware-1": {
"content": "filters",
"group": "malware",
"title": "Malware domains",
"contentURL": [
"https://mirror.cedia.org.ec/malwaredomains/justdomains",
"https://mirror1.malwaredomains.com/files/justdomains",
"assets/thirdparties/mirror1.malwaredomains.com/files/justdomains.txt",
"assets/thirdparties/mirror1.malwaredomains.com/files/justdomains"
"https://gitlab.com/curben/urlhaus-filter/raw/master/urlhaus-filter-online.txt",
"assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt"
],
"cdnURLs": [
"https://cdn.statically.io/gl/curben/urlhaus-filter/master/urlhaus-filter-online.txt",
"https://glcdn.githack.com/curben/urlhaus-filter/raw/master/urlhaus-filter-online.txt",
"https://gitcdn.xyz/repo/curbengh/urlhaus-filter/master/urlhaus-filter-online.txt",
"https://repo.or.cz/urlhaus-filter.git/blob_plain/refs/heads/master:/urlhaus-filter-online.txt"
],
"supportURL": "https://www.malwaredomains.com/"
"supportURL": "https://gitlab.com/curben/urlhaus-filter#urlhaus-malicious-url-blocklist"
},
"spam404-0": {
"content": "filters",
Expand Down
64 changes: 36 additions & 28 deletions assets/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,37 +705,41 @@
const needleNot = needle.charAt(0) === '!';
if ( needleNot ) { needle = needle.slice(1); }
let delay = '{{2}}';
const delayNot = delay.charAt(0) === '!';
if ( delayNot ) { delay = delay.slice(1); }
delay = parseInt(delay, 10);
if ( delay === '{{2}}' ) { delay = undefined; }
let delayNot = false;
if ( delay !== undefined ) {
delayNot = delay.charAt(0) === '!';
if ( delayNot ) { delay = delay.slice(1); }
delay = parseInt(delay, 10);
}
if ( needle === '' || needle === '{{1}}' ) {
needle = '';
} else if ( needle.startsWith('/') && needle.endsWith('/') ) {
needle = needle.slice(1,-1);
} else {
needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
const log = needleNot === false && needle === '' &&
delayNot === false && isNaN(delay)
const log = needleNot === false && needle === '' && delay === undefined
? console.log
: undefined;
const reNeedle = new RegExp(needle);
window.setInterval = new Proxy(window.setInterval, {
apply: function(target, thisArg, args) {
const a = String(args[0]);
const b = args[1];
let defuse = false;
if ( log !== undefined ) {
log('uBO: setInterval("%s", %s)', a, b);
} else if ( isNaN(delay) ) {
defuse = reNeedle.test(a) !== needleNot;
} else if ( needle === '' ) {
defuse = (b === delay) !== delayNot;
} else {
defuse = reNeedle.test(a) !== needleNot && (b === delay) !== delayNot;
}
if ( defuse ) {
args[0] = function(){};
let defuse;
if ( needle !== '' ) {
defuse = reNeedle.test(a) !== needleNot;
}
if ( defuse !== false && delay !== undefined ) {
defuse = (b === delay || isNaN(b) && isNaN(delay) ) !== delayNot;
}
if ( defuse ) {
args[0] = function(){};
}
}
return target.apply(thisArg, args);
}
Expand Down Expand Up @@ -776,37 +780,41 @@
const needleNot = needle.charAt(0) === '!';
if ( needleNot ) { needle = needle.slice(1); }
let delay = '{{2}}';
const delayNot = delay.charAt(0) === '!';
if ( delayNot ) { delay = delay.slice(1); }
delay = parseInt(delay, 10);
if ( delay === '{{2}}' ) { delay = undefined; }
let delayNot = false;
if ( delay !== undefined ) {
delayNot = delay.charAt(0) === '!';
if ( delayNot ) { delay = delay.slice(1); }
delay = parseInt(delay, 10);
}
if ( needle === '' || needle === '{{1}}' ) {
needle = '';
} else if ( needle.startsWith('/') && needle.endsWith('/') ) {
needle = needle.slice(1,-1);
} else {
needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
const log = needleNot === false && needle === '' &&
delayNot === false && isNaN(delay)
const log = needleNot === false && needle === '' && delay === undefined
? console.log
: undefined;
const reNeedle = new RegExp(needle);
window.setTimeout = new Proxy(window.setTimeout, {
apply: function(target, thisArg, args) {
const a = String(args[0]);
const b = args[1];
let defuse = false;
if ( log !== undefined ) {
log('uBO: setTimeout("%s", %s)', a, b);
} else if ( isNaN(delay) ) {
defuse = reNeedle.test(a) !== needleNot;
} else if ( needle === '' ) {
defuse = (b === delay) !== delayNot;
} else {
defuse = reNeedle.test(a) !== needleNot && (b === delay) !== delayNot;
}
if ( defuse ) {
args[0] = function(){};
let defuse;
if ( needle !== '' ) {
defuse = reNeedle.test(a) !== needleNot;
}
if ( defuse !== false && delay !== undefined ) {
defuse = (b === delay || isNaN(b) && isNaN(delay) ) !== delayNot;
}
if ( defuse ) {
args[0] = function(){};
}
}
return target.apply(thisArg, args);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/firefox/publish-signed-beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def get_jwt_auth():
# https://blog.mozilla.org/addons/2019/11/11/security-improvements-in-amo-upload-tools/
# "We recommend allowing up to 15 minutes."
interval = 60 # check every 60 seconds
countdown = 15 * 60 / interval # for at most 15 minutes
countdown = 60 * 60 / interval # for at most 60 minutes
headers = { 'Authorization': get_jwt_auth(), }
data = { 'channel': 'unlisted' }
files = { 'upload': f, }
Expand Down
6 changes: 3 additions & 3 deletions dist/firefox/updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"uBlock0@raymondhill.net": {
"updates": [
{
"version": "1.27.11.109",
"version": "1.28.3.0",
"browser_specific_settings": { "gecko": { "strict_min_version": "55" } },
"update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.27.11rc9",
"update_link": "https://github.com/gorhill/uBlock/releases/download/1.27.11rc9/uBlock0_1.27.11rc9.firefox.signed.xpi"
"update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.28.3b0",
"update_link": "https://github.com/gorhill/uBlock/releases/download/1.28.3b0/uBlock0_1.28.3b0.firefox.signed.xpi"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion dist/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.27.11.109
1.28.3.0
61 changes: 61 additions & 0 deletions docs/tests/static-filtering-parser-checklist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
! Title: Static Filtering Parser Checklist
! Homepage: https://github.com/gorhill/uBlock
! Licence: https://github.com/gorhill/uBlock/blob/master/LICENSE.txt
!
! Description:
! To verify that the static filtering parser is properly parsing valid and
! invalid cases, by typically adding the list to uBO, disabling the list,
! and viewing it in uBO's asset viewer.
!
! Feel free to add more entries to more throughly validate the static
! filtering parser, submit the changes in your fork of uBO by opening an
! issue at https://github.com/uBlockOrigin/uBlock-issues/issues




!-----------------------
! Parsing should succeed
!-----------------------
$script,redirect=noop.js
*$empty
*$xhr,empty
*$redirect=empty
*$xhr,redirect=empty

*$csp=default-src 'none'

*$all,~document
*$all,~popup
*$all,~inline-script
*$all,~inline-font


!--------------------
! Parsing should fail
!--------------------

! can't redirect without type (except to `empty`)
*$redirect=noop.js

! can't redirect beacon, ping, websocket
*$beacon,redirect-rule=empty
*$ping,redirect-rule=empty
*$websocket,redirect-rule=empty

! can't mix csp with other types or redirect directives
*$csp=default-src 'none',empty
*$csp=default-src 'none',redirect=empty
*$redirect=empty,csp=default-src 'none'
*$csp=default-src 'none',xhr
*$csp=default-src 'none',ghide
*$csp=default-src 'none',csp=script-src 'none'

! bad regex
/(abc|def/$xhr

! https://github.com/gorhill/uBlock/issues/2385#issuecomment-494078763
*$~document
*$~popup
*$~inline-script
*$~inline-font
10 changes: 5 additions & 5 deletions platform/chromium/vapi-usercss.pseudo.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,11 @@ vAPI.DOMFilterer = class {
let attr = node.getAttribute('style');
if ( attr === null ) {
attr = '';
} else if (
attr.length !== 0 &&
attr.charCodeAt(attr.length - 1) !== 0x3B /* ';' */
) {
attr += ';';
} else if ( attr.length !== 0 ) {
if ( attr.endsWith('display:none!important;') ) { continue; }
if ( attr.charCodeAt(attr.length - 1) !== 0x3B /* ';' */ ) {
attr += ';';
}
}
node.setAttribute('style', attr + 'display:none!important;');
}
Expand Down
5 changes: 4 additions & 1 deletion src/1p-filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>uBlock — Your filters</title>

<link rel="stylesheet" href="lib/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="lib/codemirror/addon/fold/foldgutter.css">
<link rel="stylesheet" href="lib/codemirror/addon/hint/show-hint.css">
<link rel="stylesheet" href="lib/codemirror/addon/search/matchesonscrollbar.css">

Expand Down Expand Up @@ -42,13 +43,16 @@
<script src="lib/codemirror/addon/display/panel.js"></script>
<script src="lib/codemirror/addon/edit/closebrackets.js"></script>
<script src="lib/codemirror/addon/edit/matchbrackets.js"></script>
<script src="lib/codemirror/addon/fold/foldcode.js"></script>
<script src="lib/codemirror/addon/fold/foldgutter.js"></script>
<script src="lib/codemirror/addon/hint/show-hint.js"></script>
<script src="lib/codemirror/addon/scroll/annotatescrollbar.js"></script>
<script src="lib/codemirror/addon/search/matchesonscrollbar.js"></script>
<script src="lib/codemirror/addon/search/searchcursor.js"></script>
<script src="lib/codemirror/addon/selection/active-line.js"></script>

<script src="js/codemirror/search.js"></script>
<script src="js/codemirror/ubo-static-filtering.js"></script>

<script src="js/fa-icons.js"></script>
<script src="js/vapi.js"></script>
Expand All @@ -59,7 +63,6 @@
<script src="js/dashboard-common.js"></script>
<script src="js/cloud-ui.js"></script>
<script src="js/static-filtering-parser.js"></script>
<script src="js/codemirror/ubo-static-filtering.js"></script>
<script src="js/1p-filters.js"></script>

</body>
Expand Down
Loading

0 comments on commit 839ea16

Please sign in to comment.