diff --git a/Static-filter-syntax.md b/Static-filter-syntax.md index 85976fb..f3f8eee 100644 --- a/Static-filter-syntax.md +++ b/Static-filter-syntax.md @@ -573,13 +573,22 @@ Disable inline font tags in the main page via CSP: `||example.com^$inline-font`. #### `ipaddress` -New in [1.59.1b15](https://github.com/gorhill/uBlock/commit/c6dedd253f). Related commit: [1.59.1b17](https://github.com/gorhill/uBlock/commit/030d7334e4), [1.59.1b19](https://github.com/gorhill/uBlock/commit/6acf97bf51), [1.59.1rc1](https://github.com/gorhill/uBlock/commit/6a042f152b513bbf5b3c8623ea3fbe2574ac0e24), [1.59.1rc4*](https://github.com/uBlockOrigin/uBlock-issues/issues/3381). +New in 1.60.0. The purpose is to block according to the IP address of a network request. Firefox-based browsers: full support. Chromium-based browsers: only when the IP address is used directly in the URL in lieu of a hostname. -The value assigned to `ipaddress` can either be a plain string which must match exactly a given IP address, or a regex which will be matched against the IP address. Also a wildcard can be used at the end, i.e. `192.168.*` for any IPv4 address starting with `192.168.`. +The value assigned to `ipaddress` can be ... + +- ... a plain string which must match exactly a given IP address
+ e.g. `ipaddress=192.168.1.1` to match exactly IP address `192.168.1.1` +- ... a plain string followed by a wildcard to match IP addresses starting with the pattern
+ e.g. `ipaddress=192.168.*` to match IP addresses starting with `192.168.` +- ... a regex which will be matched against the IP address
+ e.g. `ipaddress=/^192.168.1.\d{1-2}/` to match IP address between `192.168.1.0` and `192.168.1.99`. +- ... `lan` to match [IP addresses reserved for private networks](https://en.wikipedia.org/wiki/Reserved_IP_addresses)
+- ... `loopback` to match [IP addresses reserved for loopback](https://en.wikipedia.org/wiki/Loopback#Virtual_loopback_interface) Examples: @@ -593,15 +602,16 @@ Examples: Cached resources do not have a valid IP address and thus can't be a match to `ipaddress` option. +
Technical notes + +First commit in [1.59.1b15](https://github.com/gorhill/uBlock/commit/c6dedd253f). Related commit: [1.59.1b17](https://github.com/gorhill/uBlock/commit/030d7334e4), [1.59.1b19](https://github.com/gorhill/uBlock/commit/6acf97bf51), [1.59.1rc1](https://github.com/gorhill/uBlock/commit/6a042f152b513bbf5b3c8623ea3fbe2574ac0e24), [1.59.1rc4*](https://github.com/uBlockOrigin/uBlock-issues/issues/3381). + Lan/loopback values are supported (since [1.59.1b17](https://github.com/gorhill/uBlock/commit/030d7334e4)), related issue: [Possibility of Blocking Requests to localhost and Reserved IP Addresses by websockets?](https://github.com/uBlockOrigin/uBlock-issues/issues/1070). Browser-provided `0.0.0.0` IP address will be ignored when DNS is proxied (since [1.59.1rc1](https://github.com/gorhill/uBlock/commit/6a042f152b513bbf5b3c8623ea3fbe2574ac0e24)), related issue: [Some rules may break websites that use socks proxy in Firefox](https://github.com/uBlockOrigin/uBlock-issues/issues/3379). Cname uncloaking code has been rewritten to account for the `ipaddress` option (since [1.59.1b19](https://github.com/gorhill/uBlock/commit/6acf97bf51)), related issue: [Add AdGuard's $network support on Firefox](https://github.com/uBlockOrigin/uBlock-issues/issues/2792). This commit makes the DNS resolution code better suited for both filtering on cname and IP address. The change allows early availability of IP address so that `ipaddress` option can be matched at _onBeforeRequest_ time. As a result, it is now possible to block root document using `ipaddress` option -- so long as an IP address can be extracted before first _onBeforeRequest()_ call. - -Caveat: the IP address used is the first one among the list of IP addresses returned by _dns.resolve()_ method. There is no way for uBO to know which exact IP address will be used by the browser when sending the request, so this is at most a best guess. The exact IP address used by the browser is available at _onHeadersReceived_ time, and uBO will also filter according to this value, but by then the network request has already been sent to the remote server. - -Possibly a future improvement would make available the whole list of ip addresses to the filtering engine, but even then it's impossible to know with certainty which IP address will ultimately be used by the browser -- it is entirely possible that the IP address used by the browser might not be in the list received through _dns.resolve()_. +
*** @@ -952,6 +962,8 @@ Cosmetically added params cannot be removed via `removeparam` (see related comme See also: [Filter Performance](./Filter-Performance#removeparam-modifier) +*** + #### `replace` New in [1.53.1b3](https://github.com/gorhill/uBlock/commit/7c3e060c01). @@ -962,6 +974,8 @@ See + This directive will succeed only if the protocol of the current URL is either absent or matches `http:` or `https:` + +The final computed URL must be a valid URL as per [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL_API), otherwise the filter will be ignored. ```adb ||example.com/path/to/tracker$urlskip=?url @@ -1024,6 +1041,11 @@ Related issues: - [Implement `$queryjump` for static network filter](https://github.com/uBlockOrigin/uBlock-issues/issues/2693) - [[Enhancement] Add option to *automatically* visit embedded URLs w/o tracker](https://github.com/uBlockOrigin/uBlock-issues/issues/1784) +
Technical notes + +First commit in [1.59.1b22](https://github.com/gorhill/uBlock/commit/266ec4894b). +
+ *** ## Static extended filtering