AdguardTeam/FiltersRegistry

Improve removeRulePatterns

AdamWr opened this issue · 0 comments

AdamWr commented

Prerequisites

  • This problem is not related to filtering issues. Otherwise, you should read this article;
  • You're using an up-to-date version of the problematic filter;

Problem description

All modifiers from removeRulePatterns should be excluded only if occurs after (latest?) $ character.

For example, if there is exclusion like this:

,content

or

,cookie

then all rules containing this will be exclued.

For example:

giga.de#@%#(function(o){function a(a){return{get:function(){return a},set:b}}function b(){}function c(){throw"Adguard: stopped a script execution.";}var d={},e=a(function(a){a(!1)}),f={},g=EventTarget.prototype.addEventListener;o(d,{spid_control_callback:a(b),content_control_callback:a(b),vid_control_callback:a(b)});o(f,{config:a(d),_setSpKey:{get:c,set:c},checkState:e,isAdBlocking:e,getSafeUri:a(function(a){return a}),pageChange:a(b),setupSmartBeacons:a(b)});Object.defineProperty(window,"_sp_",a(f));EventTarget.prototype.addEventListener=function(a){"sp.blocking"!=a&&"sp.not_blocking"!=a&&g.apply(this,arguments)}})(Object.defineProperties);

is excluded from https://filters.adtidy.org/extension/chromium/filters/14.txt
But it's in https://filters.adtidy.org/android/filters/14.txt

The same for these rules:

bridalgown.work,contents-group.work,heisei-housewarming.work,liquidfoundation.work,nailcolor.work,studioglass.work,tapestry.work,teaceremony.work,weddinghall.work#%#//scriptlet("set-constant", "blockId", "0")
bridalgown.work,contents-group.work,heisei-housewarming.work,liquidfoundation.work,nailcolor.work,studioglass.work,tapestry.work,teaceremony.work,weddinghall.work###pr_ad

These rules are excluded from https://filters.adtidy.org/extension/chromium/filters/7.txt
But are in https://filters.adtidy.org/windows/filters/7.txt

Probably there may be also special cases like $path or $domain which should be taken into consideration to not exclude rule like:

[$path=page.html]##.textad,cookie

Proposed solution

Improve regexp.

Privacy

  • I agree to follow this condition