Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unblock rules too unspecific for certain sites #13

Closed
wmyrda opened this issue Jun 13, 2018 · 4 comments
Closed

unblock rules too unspecific for certain sites #13

wmyrda opened this issue Jun 13, 2018 · 4 comments

Comments

@wmyrda
Copy link

wmyrda commented Jun 13, 2018

https://easylist-downloads.adblockplus.org/easyprivacy.txt uses ||ria.ru/js/counter.js while
https://easylist-downloads.adblockplus.org/advblock.txt uses @@||ria.ru^$generichide
This leads to following combination

In file: ab2p.action View
--
{+add-header{DNT: 1} } .ria.ru/js/counter\.js
{ } .ria.ru/js/counter\.js
{+block{adblock rules} +server-header-tagger{ab2p-block-s} } .ria.ru/js/counter\.js
{ } .ria.ru
{+client-header-tagger{ab2p-unblock-dnt-R1636} } /(*PRUNE).*?
{-filter{ab2p-elemhide-filter} } .ria.ru
{+client-header-tagger{ab2p-unblock-elem-R1636} } /(*PRUNE).*?
{-block +client-header-tagger{ab2b-unblock-u} -server-header-tagger{ab2p-block-s} +server-header-tagger{ab2p-unblock-d} +server-header-tagger{ab2p-unblock-s} } .ria.ru
{-block +client-header-tagger{ab2p-unblock-request-Ai-Ci-when-R5458t} } /(*PRUNE).*?

Converter works fine for both as rules get created as intended for both records. Problem is however that using whitelist is meant only for element hidding while generated privoxy record allows all traffic for that site including counter which should be blocked as easyprivacy.txt record intended.

In case like that seems it is better to not create / remove ru/ria/ab2p.css instead creating too generic filter which would also disable other filters.

Workaround before using that filter with adblock2privoxy hashout all generichide whitelistings from the filter list using sed -i -e '/@@||/{/generichide/s/^/#/}' advblock.txt

@essandess
Copy link
Owner

Rule conflicts sound like an upstream issue.

Does anyone know how ab2p or EasyList handle conflicts?

@wmyrda
Copy link
Author

wmyrda commented Jun 14, 2018

I may be wrong, but IMHO it is not about rule conflict, but about missing feature in a2p. If rule uses ^$generichide for whitelist or blocklist than to un/hide elements than it should never go into the action file in {ab2p-block-s} or {ab2p-block-u} sections.

That is why following in this case is right to have it in {-filter{ab2p-elemhide-filter} but wrong in {-block +client-header-tagger{ab2b-unblock-u} -server-header-tagger{ab2p-block-s} +server-header-tagger{ab2p-unblock-d} +server-header-tagger{ab2p-unblock-s} }.

@wmyrda
Copy link
Author

wmyrda commented Aug 27, 2018

This bug is related to the #17 and basic fix is rather simple as it requires only change in templates

ab2p.system.action should add new filter which by default could be used for all sites

{+set-image-blocker{blank} \
[?CSS_DOMAIN] +filter{ab2p-elemhide-filter} \
[?CSS_DOMAIN] +filter{ab2p-elemhide-common-filter} \
 +client-header-tagger{ab2p-elemhide-check-debug} \
 +client-header-tagger{ab2p-handle-as-image-c} \
 +server-header-tagger{ab2p-handle-as-image-s}}
/

ab2p.system.filter - separate filters. this allows easy possibility to add exceptions

[?CSS_DOMAIN]FILTER: ab2p-elemhide-common-filter
[?CSS_DOMAIN]s@[^'"\s]\s*<head[^>]*>(?=\s*[^'"\s])@$&<link rel="stylesheet" type="text/css" href="http://[CSS_DOMAIN]/ab2p.common.css"></link>@iUD

 [?CSS_DOMAIN]FILTER: ab2p-elemhide-filter
[?CSS_DOMAIN]s@[^'"\s]\s*<head[^>]*>(?=\s*[^'"\s])@$&<link rel="stylesheet" type="text/css" href="http://[CSS_DOMAIN]/$host/ab2p.css"></link>@iUD

Now one can easily add sites which do not work with ab2p-elemhide-common-filter to exception list.

{-filter{ab2p-elemhide-common-filter}}
channelnewsasia\.com
\.interia\.pl
^player\.pl
\.wyborcza\.pl

In second step which would require more work it would be beneficial to add new feature which would convert all rules containing hosts with $generichide and add them only to the ab2p.action in {-filter{ab2p-elemhide-common-filter}} section

@essandess
Copy link
Owner

The CSS ab2p.common.css is used for hiding rules common to all domains; therefore, it should always be loaded. This is an issue with inconsistent rule sets, not the rule converter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants