Updated Static filter syntax (markdown)

Raymond Hill 2024-09-18 15:37:40 -04:00
parent 926a5f5ab7
commit f7166e28d7

@ -561,7 +561,7 @@ Example: `||google-analytics.com^$important,third-party` will block all network
Disable inline script tags in the main page via CSP: `||example.com^$inline-script`.
See also: [`csp`](#csp)
e also: [`csp`](#csp)
***
@ -573,21 +573,25 @@ 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). Further stabilized, improved and bugs fixed in: [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.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).
The purpose is to block according to the IP address of a network request.
In the current implementation, the filter option can only be enforced at _onHeadersReceived_ time, which means the new filter option cannot be enforced in Chromium-based browsers since the IP address of network requests is available only at _onResponseStarted_ time, which is not blocking.
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. `::*` for anything starting with `::`, and `::` for exact match (since [1.59.1rc4](https://github.com/uBlockOrigin/uBlock-issues/issues/3381), related issue: [`ipaddress=::` unexpectedly matches IPv4-mapped IPv6 addresses](https://github.com/uBlockOrigin/uBlock-issues/issues/3381)). Examples:
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.`.
Examples:
```adb
*$script,ipaddress=93.184.215.14
||xyz/|$xhr,3p,method=head,ipaddress=/^139\.45\.19[5-7]\.\d{1,3}/
*$all,ipaddress=/^::$/,domain=~0.0.0.0|~127.0.0.1|~[::1]|~[::]|~local|~localhost
||xyz/|$xhr,3p,method=head,ipaddress=/^139\.45\.19[5-7]\./
*$all,ipaddress=::,domain=~0.0.0.0|~127.0.0.1|~[::1]|~[::]|~local|~localhost
*$ipaddress=93.184.*
*$method=post,ipaddress=lan
```
The `ipaddress` option can only be enforced when the extension framework does provide a valid IP address in a _onHeadersReceived_ listener. For instance, cached resources do not have a valid IP address and thus can't be a match to `ipaddress` option.
Cached resources do not have a valid IP address and thus can't be a match to `ipaddress` option.
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).