brave/adblock-rust

$redirect-rules used with $Important act as $redirect

Opened this issue · 1 comments

As the title say, there is a problem with the $redirect-rules acting as simple $redirect when paired with the $important filter.

example: *$script,redirect-rule=noopjs,domain=brave.com,important every script will get the noopjs, just like if you used the simple $redirect filter.

If you remove the $important from the filter, then only matomo.js gets the noopjs.

It works fine in uBlock and while it is not something critical or something everyone will use, it is still a misbehavior by Brave's adblocker not to respect the $redirect-rule filter and how it only should apply redirection to blocked elements.

This redirect/important interaction has been quite frustrating in the past (#131)...

If I understand correctly:

  • adblock-rust currently treats $important as "block this regardless of any exceptions"
  • uBlock Origin treats $important as "if there's a blocking rule, block this regardless of any exceptions"

Until $redirect-rule came around, every rule was also a blocking rule so the difference didn't really matter.

It looks like there are only 5 such filters in Brave's default lists, so I agree that this isn't a super critical issue:

||google-analytics.com/analytics.js$script,redirect-rule=noopjs,domain=hudsonvalleypost.com|seacoastcurrent.com|popcrush.com,important
||googletagmanager.com/gtm.js$script,redirect-rule=noopjs,domain=hudsonvalleypost.com|seacoastcurrent.com|popcrush.com,important
||prebid.elespectador.com^$script,redirect-rule=googletagservices_gpt.js,1p,important
||rudaw.net/images/$image,1p,redirect-rule=1x1.gif,important
||elpais.com/t.gif$image,1p,redirect-rule=1x1.gif,important

The easy fix for this (duplicating all important filters without redirect-rule) would have a significant increase in memory consumption so I'll probably revisit this after some further optimizations.