AGLint icon indicating copy to clipboard operation
AGLint copied to clipboard

Improve validating of CSS rules

Open Alex-302 opened this issue 1 year ago • 5 comments

Not recognized as invalid - no CSS style / mistaken $ investing.com#$#.relative ~ div[class^="fixed bottom-0 z-50"] investing.com#@$#.relative ~ div[class^="fixed bottom-0 z-50"]

Extended CSS is detected investing.com#$?#.relative ~ div[class^="fixed bottom-0 z-50"] investing.com#@$?#.relative ~ div[class^="fixed bottom-0 z-50"]

Details

image

image

Alex-302 avatar Dec 09 '24 09:12 Alex-302

The issue here is that both ABP and ADG use the #$# / #@$# separators — ABP for snippets and ADG for style injection. If the parser cannot interpret the body as CSS injection, it falls back and parses it as ABP snippet injection, this is why you do not see error in the first case. In the second case (with the addition of the Extended CSS marker, ?), only ADG uses the separator, so a clear error message can be provided at the parser level.

There are likely two solutions to this problem:

  1. specifying the syntax more strictly and excluding ABP syntax in certain cases; or
  2. validating ABP snippets.

scripthunter7 avatar Dec 09 '24 11:12 scripthunter7

@Alex-302 You can try at https://scripthunter7.github.io/agtree-astexplorer/

scripthunter7 avatar Dec 09 '24 11:12 scripthunter7

I don't see #$# in https://easylist.to/easylist/easylist.txt https://easylist.to/easylistgermany/easylistgermany.txt

Alex-302 avatar Dec 09 '24 11:12 Alex-302

I don't see #$# in https://easylist.to/easylist/easylist.txt https://easylist.to/easylistgermany/easylistgermany.txt

I think it's for the following reason.

from https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial

For security reasons, snippet filters can only be added to a user's custom filters list or in the ABP Anti-Circumvention Filter List, the latter being vetted and reviewed.

scripthunter7 avatar Dec 09 '24 11:12 scripthunter7

Ok, I see it in https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt

Alex-302 avatar Dec 09 '24 13:12 Alex-302