uBO medium mode in Adguard browser extension

Jan Willy

Level 11
Thread author
Verified
Top Poster
Well-known
Jul 5, 2019
514
IMHO is a great advantage of uBO the use of dynamic rules besides static rules. It makes it possible to use uBO in so called Medium Mode (MM) or Hard Mode (HM).
View Blocking mode · gorhill/uBlock Wiki

When Google Manifest 3 (MV3) enters into force next year, most probably the dynamic rules will no longer work in Chromium based browsers. The absence of those rules in uBO Lite, that is intended to cooperate with MV3, points in that direction.

Can we simulate MM and HM in uBO Lite? In any case not at this moment. uBO Lite doesn’t offer the possibility to add custom rules.
But Adguard experimental browser extension MV3 does. The rules are very simple:

HM = ||*^$third-party
MM = ||*^$script,subdocument,third-party

Especially HM will break many sites. And even in MM one has to whitelist many third party sites. It’s not difficult but not as easy as in uBO. And it can start to irritate after a while.

Example of a site-specific whitelist rule in HM (example.com = third party):
@@example.com^$third-party

If you want to whitelist the third party only on a specific first party site, the whitelist rule in HM is:
@@example.com^$third-party,domain=firstparty.com

With these examples it’s easy to think of rules for MM.

A complicating factor is that Adguard MV3 still doesn’t log events. For now the most practical approach to this problem is, to use the MM rule and in advance to whitelist most common domainextensions. The blocking rule is then focussed on unusual and possible suspected third parties. I would regard this as a kind of backstop and not as a replacement of third party filterlists (such as https://raw.githubusercontent.com/Kees1958/W3C_annual_most_used_survey_blocklist/master/EU_US+most_used_ad_and_tracking_networks.txt).

An example of such a softened MM blocking rule:
||*^$script,subdocument,third-party,denyallow=com|eu|inf|io|ms|net|nl|org

Domainextension .nl is from my country.

If you want to whitelist a blocked domainextension there are two possibilities.

1.Add the domainextension to aforementioned rule.

2.Make a separate whitelist rule just for that case. E.g. regarding the domainextension .video (yes this really exists). An example:
@@.video$script,subdocument,third-party,domain=firstparty.com

As I said, Adguard MV3 still doesn’t log events. Besides above-described practical approach I use for the time being also the authentic Adguard browser extension, that also accepts the filter rules, to view the log.

For the here discussed solution I was strongly inspired by the thread “uBlock0rigin in Medium mode for Lighter and Stronger Protection, with Less websites breakage and hassle”
 
Last edited:

Max90

Level 17
Verified
Nov 9, 2022
816
@Jan Willy THANKS!

Great tutorial (y), you inspired me to add this (although a bit differently, because I am on AGv4 and AGv4 seems to ignore generic * rules)

/http:\/\/.*/$script,subdocument,important
/https:\/\/.*/$script,subdocument,third-party,denyallow=com|eu|inf|io|edu|ms|net|nl|org
 

Jan Willy

Level 11
Thread author
Verified
Top Poster
Well-known
Jul 5, 2019
514
@Jan Willy THANKS!

Great tutorial (y), you inspired me to add this (although a bit differently, because I am on AGv4 and AGv4 seems to ignore generic * rules)

/http:\/\/.*/$script,subdocument,important
/https:\/\/.*/$script,subdocument,third-party,denyallow=com|eu|inf|io|edu|ms|net|nl|org
Thanks for your compliment. In my OP I stated that I use for the time being also the authentic Adguard browser extension, that also accepts the filter rules. And those rules work well, e.g.:

AG filter rules.jpg


A request from a third party site with a not whitelisted domainextension (.cloud) is blocked.
Edit: the first party site ad.nl is not broken.
Nevertheless, your rules work in the same way.
 
Last edited:
  • Like
Reactions: Max90 and oldschool

Max90

Level 17
Verified
Nov 9, 2022
816
@JanWilly

1670672843534.png

I was playing with your rules and it generic * block did not seem to work WITHOUT domain or denyallow limitation (making the rules specific). So your rules work, but the test also showed why I was set on the wrong foot.

By the way: I am now also using the EU-US blocklist you are using. Do you also use his (Kees1958) param blocklist?

I have found a nice little blocklist for some Dutch news websites (link) and I am also using his (LennyFox) blocklist for youtube

Thanks for your tips (y)
 
Last edited:
  • Like
Reactions: oldschool

Jan Willy

Level 11
Thread author
Verified
Top Poster
Well-known
Jul 5, 2019
514
@JanWilly


I was playing with your rules and it generic * block did not seem to work WITHOUT domain or denyallow limitation (making the rules specific). So your rules work, but the test also showed why I was set on the wrong foot.

By the way: I am now also using the EU-US blocklist you are using. Do you also use his (Kees1958) param blocklist?

I have found a nice little blocklist for some Dutch news websites (link) and I am also using his (LennyFox) blocklist for youtube

Thanks for your tips (y)
You didn't use the complete rule. You forgot to add the circumflex ^ after *. Here you see that the Hard Mode rule works well:

AG filter rules.jpg


I know the filters from Kees1958 and Lenny Fox. It's a pity that they don't contribute to this forum anymore. I've learned much from them.

Instead of Kees1958 URL tracking parameters I use Adguard URL Tracking Protection and DandelionSprout's LegitimateURLShortener. Both lists cover 85% from the much smaller Kees1958 URL tracking parameters.

In my OP I linked to the extended version from Kees1958 EU US most used ads & trackers networks (third-party blocking only). But I prefer the smaller version, that suits with Google MV3:

From Lenny Fox's filters I only use https://raw.githubusercontent.com/LennyFox/Blocklists/master/videos.txt
But thanks for the tip.
 

Max90

Level 17
Verified
Nov 9, 2022
816
@Jan Willy

Maybe you learned from them, but now I learn from you :)


Thanks for pointing me to the short Kees1958 version. I am using Firefox on my Android phone and have disconnect anti-tracking enabled.

LennyFox videos is the same as the youtube list (title is videos, but only has youtube rules).

I am using Kees1958 param (both in phone and desktop). I had two (now obsolete) reasons to use Kees1958 para. List

1. Kees1958 param used to look more organized than the AdGuard param filter version. I say usef, because AG now also labels and groups the rules in the same way like Kees1958 does.

2. Kees1958 is smaller and is Dutch, so I assumed also beingwould less likely cause any conflicts. But after 1.5 year of using param blocklist, I never ran into website breakage.
 

Max90

Level 17
Verified
Nov 9, 2022
816
@ Jan Willy (y)(y)(y)

Since december 10th using your tip and have not added a single exception.

!
! Blokkeer third-party javascript en iframes behalve op een aantal Country codes en generieke Top Level Domains
!
! NL = Nederland
! BE = België
! DE = Duitsland
! UK = Groot Britannië
! EU = Europa
! com = commerciële organisaties
! org = non-profit organisaties
! net = netwerk organisaties
! inf = informatie webservices
! io = input/output webservices
! ms = Microsoft websites
!
||*$third-party,script,subdocument,denyallow=NL|BE|DE|UK|EU|com|org|net|inf|io|ms
 

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top