FiltersHeroes / ScriptsPlayground

A place for testing and developing our scripts.
10 stars 4 forks source link

FOP - malform a few network filters #8

Closed realodix closed 3 years ago

realodix commented 3 years ago

FOP 3.19

Step

Expected _foobar.$domain=~example.com

Actual _foobar.$domain= ~ example.com

krystian3w commented 3 years ago

Interestingly, we have a little similar filter and there was no bug:

||dlastudenta.pl/cookie/cookie_set.js$script,~third-party,domain=~www.dlastudenta.pl
||dlastudenta.pl/cookie/upd/$~third-party,xmlhttprequest,domain=~www.dlastudenta.pl

I suppose bugged here: https://github.com/PolishFiltersTeam/ScriptsPlayground/blob/260de4390a5b6b8f03d3fab2ab307ecabdcc7481/scripts/FOP.py#L41

or in: https://github.com/PolishFiltersTeam/ScriptsPlayground/blob/260de4390a5b6b8f03d3fab2ab307ecabdcc7481/scripts/FOP.py#L189-L220

gwarser commented 3 years ago

Tu chyba powinny być gwiazdki:

https://github.com/PolishFiltersTeam/ScriptsPlayground/blob/260de4390a5b6b8f03d3fab2ab307ecabdcc7481/scripts/FOP.py#L424-L431

filtertext[0] == "" -> filtertext[0] == "*"? filtertext[-1] == "" -> filtertext[-1] == "*"?

Kiedyś były: https://github.com/adblock-thai/thai-ads-filter/blame/bf2d67c0afd2777cbd2f06f0613ec03a10c8bf58/FOP.py#L392-L397, https://github.com/adblock-thai/thai-ads-filter/commit/017f1473421f8d707d5c5ecc0d9ecccda00490fc

gwarser commented 3 years ago

Does it happen with /_foobar.$domain=~example.com?

If not,

_foobar.$domain=~example.com is matching ELEMENTPATTERN and filter is run through elementtidy.

x ~ y - beautified syntax for general sibling combinator.


Broken here: https://github.com/PolishFiltersTeam/ScriptsPlayground/commit/aa89c9c4a8b5f9dc690caf6452c58709be0e9eba ?

krystian3w commented 3 years ago

Does it happen with /_foobar.$domain=~example.com?

No.


Also:


Idea with beautified CSS path may match.

krystian3w commented 3 years ago

@hawkeye116477 this is good:

^([^\/\*\|\@\"\!]*?)(\$\@?\$?\??#|##\@?\$|#\@?#?\+?)(.*)$
* `$$` * `$@$` * `##` * `#@#` * `#?#` * `#@#` * `#@?#` * `#$#` * `#@$#` * `#$?#` * `#@$?#` * `#%#` * `#@%#`
html filtering simple CSS ExtendedCSS / procedural filter CSS filter

(or ABP scriptlet / snippet)
CSS inline filter AdGuard scriptlet

hawkeye116477 commented 3 years ago

Maybe I will see all after holidays :smile:

hawkeye116477 commented 3 years ago

@krystian3w It's wrong, cuz html filtering can be without hash, for example example.org$$script[data-src="banner"].