uBlockOrigin / uBlock-issues

This is the community-maintained issue tracker for uBlock Origin
https://github.com/gorhill/uBlock
935 stars 79 forks source link

Convert "$rewrite=abp-resource" into "$redirect" #857

Closed DandelionSprout closed 3 years ago

DandelionSprout commented 4 years ago

Prerequisites

Description

Three relatively important lists (EasyList, Liste FR, ABP Anti-Circumvention), two of which are included in uBO, have begun to write entries based on $rewrite=abp-resource, which is quite obviously based on uBO and AdGuard's $redirect but is not supported by uBO. I therefore suppose that converting $rewrite=abp-resource entries into their $redirect equivalents could be something to do.

Although https://help.eyeo.com/adblockplus/how-to-write-filters#rewrite lists 9 internal resources, only 2 are known by me to be used in any lists ever made (excluding the ABP-specific version of my Nordic list), namely blank-mp3 and blank-js.

Comprehensive listing of all $rewrite=abp-resource entries I could find in major lists:

EasyList:
||slacker.com^*/getspot/?spotid=$media,rewrite=abp-resource:blank-mp3,domain=slacker.com

Liste FR:
||delivery.tf1.fr/pub$media,rewrite=abp-resource:blank-mp3,domain=tf1.fr
||dnl-adv-ssl.tf1.fr^$media,rewrite=abp-resource:blank-mp3,domain=tf1.fr
||loadshare.org/custom/$media,$rewrite=abp-resource:blank-mp3,domain=01fmovies.com [sic; I've reported that entry's use of two $'s to the Lanik forum.]
||static.6cloud.fr^*.mp4$media,rewrite=abp-resource:blank-mp3,domain=6play.fr
||tf1.fr/assets/js/build/lib/ad$rewrite=abp-resource:blank-js,domain=tf1.fr

ABP Anti-Circumvention:
||glomex.com^$media,rewrite=abp-resource:blank-mp3,domain=player.glomex.com
||adform.net/banners/scripts/adx.js$domain=delfi.lt,rewrite=abp-resource:blank-js

My presumption for how such conversions could work:

As this issue report is specifically about extension-internal resources, I'm pretty sure it's not a duplicate of https://github.com/uBlockOrigin/uBlock-issues/issues/46.

A specific URL where the issue occurs

N/A

Steps to Reproduce

  1. Download Nano Adblocker, as it has a syntax checker that uBO doesn't have.
  2. Check out Liste FR from within that extension.
  3. Ctrl+F your way down to the $rewrite=abp-resource entries.
  4. See that they're marked in bright red, which means that Nano and uBO thinks of the entry as invalid.

Expected behavior:

That the entries are not marked in red in Nano's list syntax checker.

Actual behavior:

That the entries are treated as invalid.

Your environment

gorhill commented 4 years ago

Three relatively important lists (EasyList, Liste FR, ABP Anti-Circumvention), two of which are included in uBO

"ABP Anti-Circumvention" should never ever be added to uBO, it's specifically made for ABP and is likely to break uBO in bad ways -- it was never designed for any other blocker than ABP (and its subsidiaries blockers).

We must make sure to make it known that this list should never be used in uBO; opening an issue of compatibility with "ABP Anti-Circumvention" suggests that the list should be used in uBO, which is opposite of the official advice.

That said, I agree that uBO should try to increase compatibility with EasyList and Liste FR.

vlaszlo commented 4 years ago

We must make sure to make it known that this list should never be used in uBO; opening an issue of compatibility with "ABP Anti-Circumvention" suggests that the list should be used in uBO, which is opposite of the official advice.

A first step there would be to notify the maintainer(s) of FilterLists to remove the uBO (and possibly Nano Adblocker) compatibility icons from their listings of the ABP Anti-Circumvention filter lists.

uBlock-user commented 4 years ago

/cc @collinbarrett

DandelionSprout commented 4 years ago

Speaking by virtue of being the main infobase updater on that site, I'll agree to mark that list as ABP- and AdBlock-only, but I'll do it on the grounds of Anti-Circumvention's extensive use of #$# scriptlets and :-abp-properties, and not necessarily for you guys' reasons.

krystian3w commented 4 years ago

ABP do not have important so few rewrite newer works if any added exception @@ in the past.


ABP also no need type blocked of request?

||tf1.fr/assets/js/build/lib/ad$rewrite=abp-resource:blank-js,domain=tf1.fr

above no have media / object / script / xhr etc.

DandelionSprout commented 4 years ago

I've also noticed that it'd be plausibly feasible to convert $webrtc (of which there's a lot of entries in EasyList and EasyList-hosted lists) into ##+js(nowebrtc), but I'm unsure if that's a matter for a separate issue report or not.

krystian3w commented 4 years ago

Better new - ABP can use regex/wildcard for webrtc (?) - uBO for domains / TLD only (?).

! no possible convert
/bitcon.(js|aspx?)/$webrtc

⬇️

! unknown domain if no have before `$` or `domain=`
...##+js(nowebrtc)

⬇️

! invalid regex (redirect reject this) and type of block request
/bitcon.(js|aspx?)/$all,redirect=nowebrtc.js
gorhill commented 3 years ago

I did add compatibility, but frankly it does not feel like an accomplishment which benefit uBO and rather like a feeling of having wasted time on a non issue given that none of the cases provided is an issue for uBO ever since uBO has replaced Liste FR with AdGuard Français.

DandelionSprout commented 3 years ago

This will make it easier for e.g. EasyList, EasyList Spanish, EasyList Italy, and other officially ABP-affiliated lists to add these kind of entries to their lists, so I am firmly confident that your efforts were not wasted.

It's currently an open question how many such lists that would add such entries now, however.

krystian3w commented 3 years ago

Maybe depend how old ABP must be supported by EasyList projects - if any very old ABP 1.0 / 1.1 & 2.0 maybe rare of lists start use rewrite for ABP users if works exception and cosmetic hide ad-reinsertion.

gorhill commented 3 years ago

I don't understand how this would make it easier for ABP-affiliated list maintainers -- surely uBO was not preventing them from making use of whatever ABP-specific options they wanted to use? For example, they do not shy away from using :-abp-properties() even if uBO is not recognizing that filter option.

gorhill commented 3 years ago

Additionally, the reason ABP-affiliated maintainers are not using rewrite= as much as they would is probably because of an implementation flaw in ABP: https://gitlab.com/eyeo/adblockplus/adblockpluscore/-/issues/241.

If a block filter is found before a rewrite= filter, the rewrite= will never be applied, and maintainers have no control over that internal behavior of ABP's filtering engine.

DandelionSprout commented 3 years ago

Okay, those are admittedly good points.