$badfilter rules with collisions break the filtering engime
Prerequisites
-
[x] I have checked the Wiki and Discussions and found no answer
-
[x] I have searched other issues and found no duplicates
-
[x] I want to report a bug and not ask a question or ask for help
-
[x] I have set up AdGuard Home correctly and configured clients to use it. (Use the Discussions for help with installing and configuring clients.)
Platform (OS and CPU architecture)
Linux, AMD64 (aka x86_64)
Installation
GitHub releases or script from README
Setup
On one machine
AdGuard Home version
0.107.52
Action
I am using ShadowWhisperer's TLD list which was recently formatted to work with AdGuard Home, however, I am also using whitelist based filtering for all Microsoft domains, meaning github.io is filtered as well.
As I wished for my filtering to exclude the top 100 TLDs, I created rules like
||*.io^badfilter
-to prevent the rule blocking .io and the other top TLDs from executing.
The issue I found is that when you have a domain blocked two or more ways, doing something like
||*.io^badfilter
||github.io^badfilter
-does not act as it should, and github.io and all subdomains remain blocked.
I could whitelist github.io explicitly, but due to it being a UGC domain, I would much rather the bug be fixed to avoid such broad whitelists.
Expected result
The expected result is that both rules should be deactivated, as this is how it works in, eg; uBlock Origin.
Actual result
All other .io domains minus github.io are affected by the badfilter rule for .io
Additional information and/or screenshots
No response
See: https://adguard-dns.io/kb/general/dns-filtering-syntax/#badfilter-modifier
Use ||*.io^$badfilter ;)
Thanks for the report. The examples need a $ before the modifier:\n\ntext\n||*.io^$badfilter\n||github.io^$badfilter\n\n\nAfter correcting that syntax, I reproduced the underlying collision on current AdGuard Home master with the pinned urlfilter v0.23.4. A single blocking rule and its exact $badfilter counterpart work correctly. When two blocking rules match the same hostname and both have exact $badfilter counterparts, the current nested filtering loop can re-add a rule that another $badfilter removed, so the hostname remains blocked.\n\nThe dependency-level fix and regression tests are in AdguardTeam/urlfilter#50. I independently verified the failure against v0.23.4, then ran the focused collision/duplication tests 20 times and the full urlfilter suite under the race detector against the proposed fix; all passed.\n\nAfter that PR is merged and released, AdGuard Home will need one focused urlfilter dependency update with an integration regression. This also explains #7873.
Hello. Could you please tell me if the solution suggested by @hagezi helped you?
Closed due not reply