brave / brave/adblock-rust

Support denyallow adblock rules

Open
#720 0 comments 1 reaction 1 assignee Claimed by @antonok-edm View on GitHub
Dominant language
Rust
Stars
2.8k
Forks
250
Avg merge
1d 16h
Merged PRs (30d)
6

Description

uBlock Origin introduced the `denyallow` option for network filters in 1.25.3b4, as noted in the [static filter syntax documentation](https://github.com/gorhill/uBlock/wiki/Static-filter-syntax).

> The purpose of `denyallow` is bring default-deny/allow-exceptionally ability into static network filtering arsenal.
>
> Example:
>
> ```
> *$3p,script,denyallow=x.com|y.com,domain=a.com|b.com
> ```
> The above filter tells the network filtering engine that when the context is `a.com` or `b.com`, block all 3rd-party scripts except those from `x.com` and `y.com`.
>
> Essentially, the new `denyallow` option makes it easier to implement default-deny/allow-exceptionally in static filter lists, whereas before this had to be done with unwieldy regular expressions[1], or through the mix of broadly blocking filters along with exception filters[2].
>
> [1] hg.adblockplus.org/ruadlist/rev/f362910bc9a0
>
> [2] Typically filters which pattern are of the form `|http*://`

As of the time of this issue this syntax is already used in at least one rule at https://github.com/uBlockOrigin/uAssets/blob/3607fd8adf53104fc22c84c52dc495fb74b41864/filters/filters-2020.txt#L2410:
`*$3p,script,domain=boards.4channel.org,denyallow=4cdn.org|4chan.org|google.com|gstatic.com|cdn.mathjax.org|cdnjs.cloudflare.com|hcaptcha.com`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.