AdguardTeam / AdguardBrowserExtension

AdGuard browser extension
https://adguard.com/
GNU General Public License v3.0
3k stars 321 forks source link

Wildcard support for domain name #2297

Open tumatanquang opened 1 year ago

tumatanquang commented 1 year ago

Issue Details

I'm experiencing a situation where some websites frequently change domain names that are quite similar after a short time, but basically, the new domains are quite similar to the old one, differing only in a few characters at the end of the domain name, for example:

Old: domain.tld -> New: domain1.com Old: domain1.com -> New: domain2.net Old: domain2.net -> New: domainZ.org etc...

However, currently only wildcards for TLDs are supported, i.e. if I write the rule:

domain*.*##some-rule

It won't work on any domain at all. So I expect wildcard support for domain names to be added in the next updated version.

Proposed solution

In addition to wildcard support for TLDs, support wildcard for domain names

Alternative solution

No response

mozartinio commented 1 year ago

@tumatanquang Hi! Wildcard for domain name (not domain zone) - it is not safe because there can be wrong blocking with another useful sites

tumatanquang commented 1 year ago

@tumatanquang Hi! Wildcard for domain name (not domain zone) - it is not safe because there can be wrong blocking with another useful sites

I'm not sure which of the "another useful sites" you're referring to, but domains that are nearly identical (or only partially different) will often be the same owner or will be alias of each other or even phishing domains. If the wildcard for the domain is not safe, I hope there is another solution, like regex support for the domain name. In this case, perhaps the regex will be a little faster than the wildcard.

tumatanquang commented 1 year ago

@kodiakhub

Do you mean this feature? point_right AdguardTeam/CoreLibs#1550

Believe me, I've been waiting for a long time. smile

Even if the feature may not be entirely safe for AdGuard, but it is quite useful for users, meaning for User rules. +1

Not really, not just modifier, I need more with the Verbatim text section. image

krystian3w commented 1 year ago

Simple network filtering rule can be rewritten to regex if wildcard allow too much:

! block load images from/on "example1.com" on whole Internet, but allow from/on "exampled.com"
!
/(\.|\/)example[\d]+\.com/$image

It is only problematic to guard against catastrophic regex when you want to handle subdomains other than "www." or nested multiple times like: very.bad.gaga.example2.com.

Certainly a bit of a lime as for web filtering rules, regex in the domain modifier has not been implemented:

! uBlock Origin experimental:
||foo.bar^$domain=/example[\d]+\.com/
!
! AdGuard possible "stable" implementation (❓):
||foo.bar^$[domain=example[\d]+\.com]