Skip to content

Dynamic filtering: quick guide

Raymond Hill edited this page Jul 14, 2020 · 89 revisions

Back to Dynamic-filtering


Dynamic filtering pane (available only to advanced users) can be toggled off/on by clicking on the Less/More buttons:

figure 1


Important:

Static filtering refers to the filters which comes from the filter lists, i.e. EasyList, EasyPrivacy, hpHosts, etc. Dynamic filtering are those filtering rules which have an air of firewall rules.


First column: what is to be dynamically filtered:

figure 2

As you can see, you can create dynamic filtering rules for resource types, or hostnames according to their origin.

The color of an entry indicates whether all requests were blocked (reddish), all requests were allowed (greenish), or some were blocked some were allowed (yellowish).

In bold, domain names. Domain names are hostnames, but hostnames are not necessarily domain names from uBlock's point of view: domain names are extracted as per Mozilla Public Suffix list.

Second column: global dynamic filtering rules, i.e. whatever rule appears in this column applies everywhere, on all sites:

figure 3

Third column: local dynamic filtering rules, i.e. whatever rule appears in this column applies to the current site only:

figure 4

The cells in the third column gives an overview of how many requests were blocked/allowed:

  • - or + = between 1-9 network requests were blocked or allowed, respectively
  • -- or ++ = between 10-99 network requests were blocked or allowed, respectively
  • --- or +++ = 100 or more network requests were blocked or allowed, respectively
  • blank cell = no network requests occurred for the specific hostname

So there are global dynamic filtering rules, and local dynamic filtering rules.

By default, there are no dynamic filtering rules at install time, so nothing is blocked by default by the dynamic filtering engine. You will have to create your own rules, according to your own prerogatives.

Sensible security- and privacy-wise: blocking all 3rd-party frames by default everywhere:

figure 5


Important:

Dynamic filtering overrides static filtering.

This means a block dynamic rule will override any existing allow static filters. This means you can block with 100% certainty using dynamic filtering rules. Similarly, an allow dynamic filtering rule will override any existing block static filters, i.e. you can allow with 100% certainty with dynamic filtering (useful to un-break sites broken by some static filters).

This may help understand how static and dynamic filtering interact: Overview of uBlock's network filtering engine.


All embedded 3rd-party frames were blocked on the page. Good. However it appears there was an embedded YouTube video in the article:

figure 6

If you want to block all 3rd-party frames by default, except for embedded YouTube videos on that particular site, two solutions.

First solution

Create a local noop rule for 3rd-party frames:

figure 7

It works, the embedded YouTube video can now be played.

Note that a cell with a noop rule is dark gray, while a cell with no rule at all is light gray (the default color). Hence gray means that no dynamic filtering will be applied to a cell. If a cell inherit a block or allow rule from a higher precedence cell, a noop rule can be used to override the inherited block or allow rule. Conceptually, the purpose of noop rules is to punch holes in your dynamic filtering ruleset so that network requests can pass through unimpeded.

However the above rule would result in all 3rd-party frames on the site to be unblocked. Not so good.

Second solution

Create a local noop rule for youtube.com (and for the specific page used as example, a noop rule for google.com also had to be created to un-break the embedded Youtube video):

figure 8

This will prevent dynamic filtering rules to apply to network requests to youtube.com, but only for the current site.


Important:

Remember that noop rules bypass only broader dynamic filtering rules, static filtering is left completely intact, which means you won't see ads in the embedded YouTube videos.


What if you want to block 3rd-party frames everywhere by default, but want whatever embedded YouTube video to not be blocked by default on any site?

It is just a matter of creating a global noop rule for youtube.com:

figure 9

Which means: do not apply any dynamically filtering rule to youtube.com by default (i.e. everywhere).


Important:

Local dynamic filtering rules override global ones.

In other words: More specific dynamic filtering rules override less specific ones. For example, dynamic filtering rules for youtube.com (specific) override dynamic filtering rules for 3rd-party frames (generic).


All dynamic rules are temporary by default: Click the padlock if you want to persist the ruleset for a specific web site.

figure 12

  • The padlock will be visible if and only if there is at least one temporary rule in the pane
  • This is really the optimal way to use dynamic filtering, as using this feature is often a matter of trial and error
  • This prevents ruleset pollution: your ruleset will be only those rules which you will have explicitly persisted
  • If you Ctrl-click to set/unset a rule, it will be immediately persisted (command ⌘-click on Mac)

We covered the block and noop dynamic filtering rules. What about the allow rule?

The dynamic filtering allow rule is most useful to un-break sites broken by some static filters.

Someone found out Boldchat site was broken when using uBlock:

figure 10

The content of the dynamic filtering pane makes it clear that there is a static filter somewhere blocking network requests to boldchat.com. Turned out there was static filter boldchat.com in "Peter Lowe's Ad Server" list.

Using a local allow dynamic filtering rule fixes the breakage:

figure 11

It is easier for a user to point-and-click for a quick fix than to actually craft an exception static filter like @@||boldchat.com$~third-party and force a reload of all static filters (big memory churning).

Another example of un-breaking a site.


Important:

Typically, use only narrow allow dynamic filtering rules to un-break sites. As these allow rules override any static filtering, this means if you use a too broad allow dynamic filtering rule you could start to allow in ads/trackers/annoyances.


More: Take control of your privacy in your own hands (will move this here eventually, I need a break)

Clone this wiki locally