From 4d982d9972be4eb0a23e289c6f3ec3ae8cca36f2 Mon Sep 17 00:00:00 2001 From: Fanboynz Date: Sat, 12 Oct 2024 01:26:37 +1300 Subject: [PATCH 1/7] Add forbidden/forever values (#3925) --- assets/resources/scriptlets.js | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index cd4c7ea0cb227..8db2877fcb87a 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -1002,6 +1002,7 @@ function getSafeCookieValuesFn() { 'enable', 'disable', 'enabled', 'disabled', 'essential', 'nonessential', + 'forbidden', 'forever', 'hide', 'hidden', 'necessary', 'required', 'ok', From 01eebffc1fd133f4f72f886551e79ba4bfc3bb24 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 11 Oct 2024 08:54:50 -0400 Subject: [PATCH 2/7] Add `-uricomponent` to `urlskip=` option To unescape URI-encoded characters. Related discussion: https://github.com/uBlockOrigin/uBlock-issues/issues/3206#issuecomment-2406479971 --- src/js/static-net-filtering.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 6bd9fe00cd83f..92fc51b33cb2a 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -5406,6 +5406,8 @@ StaticNetFilteringEngine.prototype.transformRequest = function(fctxt, out = []) * * `-base64`: decode the current string as a base64-encoded string. * + * `-uricomponent`: decode the current string as a URI component string. + * * At any given step, the currently extracted string may not necessarily be * a valid URL, and more transformation steps may be needed to obtain a valid * URL once all the steps are applied. @@ -5470,10 +5472,18 @@ function urlSkip(directive, urlin, steps) { urlout = `https://${s}`; continue; } - // Decode base64 - if ( c0 === 0x2D && step === '-base64' ) { - urlout = self.atob(urlin); - continue; + // Decode + if ( c0 === 0x2D ) { + // Base64 + if ( step === '-base64' ) { + urlout = self.atob(urlin); + continue; + } + // URI component + if ( step === '-uricomponent' ) { + urlout = self.decodeURIComponent(urlin); + continue; + } } // Regex extraction from first capture group if ( c0 === 0x2F ) { // / From caba9cdefa082fa36c82a9888bc84f3dbec5c7a2 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 11 Oct 2024 09:03:30 -0400 Subject: [PATCH 3/7] Use uBO's default listset --- platform/npm/demo.js | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/platform/npm/demo.js b/platform/npm/demo.js index ebe314b2fdf6d..bc0ca87a1f7e3 100644 --- a/platform/npm/demo.js +++ b/platform/npm/demo.js @@ -36,6 +36,17 @@ import { StaticNetFilteringEngine } from '@gorhill/ubo-core'; /******************************************************************************/ +async function fetchList(name, url) { + return fetch(url).then(r => { + return r.text(); + }).then(raw => { + console.log(`${name} fetched`); + return { name, raw }; + }).catch(reason => { + console.error(reason); + }); +} + async function main() { const pathToSelfie = 'cache/selfie.txt'; @@ -62,24 +73,14 @@ async function main() { if ( !selfie ) { console.log(`Fetching lists...`); await snfe.useLists([ - fetch('https://easylist.to/easylist/easylist.txt') - .then(r => { - return r.text(); - }).then(raw => { - console.log(`easylist fetched`); - return { name: 'easylist', raw }; - }).catch(reason => { - console.error(reason); - }), - fetch('https://easylist.to/easylist/easyprivacy.txt') - .then(r => { - return r.text(); - }).then(raw => { - console.log(`easyprivacy fetched`); - return { name: 'easyprivacy', raw }; - }).catch(reason => { - console.error(reason); - }), + fetchList('ubo-ads', 'https://ublockorigin.github.io/uAssetsCDN/filters/filters.min.txt'), + fetchList('ubo-badware', 'https://ublockorigin.github.io/uAssetsCDN/filters/badware.min.txt'), + fetchList('ubo-privacy', 'https://ublockorigin.github.io/uAssetsCDN/filters/privacy.min.txt'), + fetchList('ubo-unbreak', 'https://ublockorigin.github.io/uAssetsCDN/filters/unbreak.min.txt'), + fetchList('ubo-quick', 'https://ublockorigin.github.io/uAssetsCDN/filters/quick-fixes.min.txt'), + fetchList('easylist', 'https://easylist.to/easylist/easylist.txt'), + fetchList('easyprivacy', 'https://easylist.to/easylist/easyprivacy.txt'), + fetchList('plowe', 'https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext'), ]); const selfie = await snfe.serialize(); await fs.mkdir('cache', { recursive: true }); From b8959dcca9ad2bfcd50bc2c322021f5d1ac473f2 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 11 Oct 2024 09:04:23 -0400 Subject: [PATCH 4/7] Comment --- src/js/static-net-filtering.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 92fc51b33cb2a..73218aba5b194 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -5406,7 +5406,7 @@ StaticNetFilteringEngine.prototype.transformRequest = function(fctxt, out = []) * * `-base64`: decode the current string as a base64-encoded string. * - * `-uricomponent`: decode the current string as a URI component string. + * `-uricomponent`: decode the current string as a URI encoded string. * * At any given step, the currently extracted string may not necessarily be * a valid URL, and more transformation steps may be needed to obtain a valid From d0ae3c3e77c7e5408ddd440c7205c9732bf26a88 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 11 Oct 2024 09:06:49 -0400 Subject: [PATCH 5/7] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8241635b1edf..7111358dd76d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- [Add `-uricomponent` to `urlskip=` option](https://github.com/gorhill/uBlock/commit/01eebffc1f) +- [Add `forbidden`/`forever` as safe cookie values](https://github.com/gorhill/uBlock/commit/4d982d9972) (by @ryanbr) - [Add regex extraction transformation step to `urlskip=` option](https://github.com/gorhill/uBlock/commit/c86ed5287b) - [Improve `prevent-window-open` scriptlet](https://github.com/gorhill/uBlock/commit/85877b12ed) - [Add support to parse Adguard's `[$domain=/.../]` regex-based modifier](https://github.com/gorhill/uBlock/commit/58bfe4c846) From f5a7053acb8bf1d67579ecaa1561bb9abe8ee4fa Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 11 Oct 2024 09:07:12 -0400 Subject: [PATCH 6/7] New revision for dev build --- dist/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/version b/dist/version index 738bba80466b5..080adefd7cd65 100644 --- a/dist/version +++ b/dist/version @@ -1 +1 @@ -1.60.1.11 \ No newline at end of file +1.60.1.12 \ No newline at end of file From 44bcb5fd996e6f54eea355ed667bac8a5d664b68 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 11 Oct 2024 09:15:40 -0400 Subject: [PATCH 7/7] Make Firefox dev build auto-update --- dist/firefox/updates.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/firefox/updates.json b/dist/firefox/updates.json index 9637cf7c5f058..ace180c1a03d2 100644 --- a/dist/firefox/updates.json +++ b/dist/firefox/updates.json @@ -3,9 +3,9 @@ "uBlock0@raymondhill.net": { "updates": [ { - "version": "1.60.1.11", + "version": "1.60.1.12", "browser_specific_settings": { "gecko": { "strict_min_version": "78.0" } }, - "update_link": "https://github.com/gorhill/uBlock/releases/download/1.60.1b11/uBlock0_1.60.1b11.firefox.signed.xpi" + "update_link": "https://github.com/gorhill/uBlock/releases/download/1.60.1b12/uBlock0_1.60.1b12.firefox.signed.xpi" } ] }