Commit Graph

12617 Commits

Author SHA1 Message Date
Raymond Hill 266ec4894b
New static network filter option `urlskip=`
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3206

The main purpose is to bypass URLs designed to track whether a user
visited a specific URL, typically used in click-tracking links.

The `urlskip=` option ...

- ... is valid only when used in a trusted filter list
- ... is enforced only on top documents
- ... is enforced on both blocked and non-blocked documents
- ... is a modifier, i.e. it cannot be used along with other
      modifier options in a single filter

The syntax is `urlskip=[steps]`, where steps is a space-separated
list of extraction directives detailing what action to perform on
the current URL.

The only supported directive in this first commit is `?name`,
which purpose is to extract the value of a named URL parameter
and use the result as the new URL. Example:

  ||example.com/path/to/tracker$urlskip=?url

The above filter will cause navigation to

  https://example.com/path/to/tracker?url=https://example.org/

to automatically bypass navigation to `example.com` and navigate
directly to

  https://example.org/

It is possible to recursively extract URL parameters by using
more than one directive, example:

  ||example.com/path/to/tracker$urlskip=?url ?to

More extraction capabilities may be added in the future.
2024-09-15 09:17:19 -04:00
Raymond Hill 4b285c0593
Dynamically load DNR conversion module on-demand
DNR conversion module is a dev tool, no point loading it by
default. This was done this way because in a distant past uBO
had to be compatible with browsers not supporting dynamically
loaded modules.

Currently all supported browser versions support dynamically
loaded modules.
2024-09-14 12:13:47 -04:00
Raymond Hill c265e849e0
Fetch and cache cname of collated hostnames in page store
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3376
2024-09-14 11:50:10 -04:00
Raymond Hill f936dfa648
Fix potential failure to unregister scriptlet
In Firefox-specific contentScripts API used to register
scriptlets. This could potentially occurs when there are
registrations pending during a reload of filter lists.
2024-09-14 09:32:37 -04:00
Raymond Hill 41d49921c8
Minor code review 2024-09-14 09:20:54 -04:00
Raymond Hill f9ab4b7504
Make Firefox dev build auto-update 2024-09-14 00:15:41 -04:00
Raymond Hill 42700a6f76
New revision for dev build 2024-09-14 00:12:00 -04:00
Raymond Hill 5e6f78a902
Fix regression re. `mp4` filter option
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3375
2024-09-14 00:10:34 -04:00
Raymond Hill 93042eced4
Use dummy dns API when it's not present 2024-09-13 11:20:37 -04:00
Raymond Hill d1db02b04c
Make Firefox dev build auto-update 2024-09-13 10:11:27 -04:00
Raymond Hill 63e5611877
New revision for dev build 2024-09-13 10:04:13 -04:00
Raymond Hill 73ee3ffe92
Code review of DNS-related code
Related commit:
6acf97bf51
2024-09-13 10:00:41 -04:00
Raymond Hill 8fadfb2c5e
Import translation work from https://crowdin.com/project/ublock 2024-09-12 15:40:24 -04:00
Raymond Hill 671b0c540c
Make Firefox dev build auto-update 2024-09-12 12:06:26 -04:00
Raymond Hill 9b967eccc8
New revision for dev build 2024-09-12 11:42:03 -04:00
Raymond Hill 71f07b18ae
Update changelog 2024-09-12 11:41:26 -04:00
Raymond Hill 6acf97bf51
Rewrite cname uncloaking code to account for new `ipaddress=` option
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.

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2792

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().
2024-09-12 11:19:57 -04:00
Raymond Hill 44b6519db1
Make Firefox dev build auto-update 2024-09-11 10:41:19 -04:00
Raymond Hill 0e2f04eb2b
New revision for dev build 2024-09-11 10:21:50 -04:00
Raymond Hill 099b9852cd
Code review for `ipaddress=` filter option
If an IP address can be extracted from the hostname portion of
a URL, the IP address matching will be performed at onBeforeRequest()
time.

Regardless, IP address matching will subsequently always be performed
at onHeadersReceived() time as the request details at that point
contain a reliable IP address value on supported platforms (Firefox-
only as of now).

The `cap_ipaddress` now evaluates to `true` in Chromium-based
browsers. Even though these browsers are unable to provide reliable
IP address value at onHeadersReceived() time, they can still
perform IP address matching for IP address extracted from hostname
portion of a URL.
2024-09-11 09:56:44 -04:00
Raymond Hill c19497db33
Update changelog 2024-09-10 15:13:28 -04:00
Raymond Hill d5f14ffa32
Avoid using dns.resolve() for proxied DNS resolution
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/1743
2024-09-10 14:58:40 -04:00
Raymond Hill 09ccfc8cfb
Make Firefox dev build auto-update 2024-09-10 12:11:03 -04:00
Raymond Hill 0ae02788b2
New revision for dev build 2024-09-10 11:56:13 -04:00
Raymond Hill 185580d23f
Update changelog 2024-09-10 11:55:53 -04:00
Raymond Hill 401d2e8ea9
[mv3] Mind unsupported `header=`/`ipaddress` options in DNR API
Properly report unsupported `header=` and `ipaddress=` option in
log file.

`header=` support may become possible soon with Chromium 128
introducing blocking according to response headers content.
2024-09-10 11:50:09 -04:00
Raymond Hill 030d7334e4
Add support for `lan`/`loopback` values to `ipaddress=` option
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/1070
2024-09-10 11:11:11 -04:00
Raymond Hill 839857dd4b
Make Firefox dev build auto-update 2024-09-09 11:15:41 -04:00
Raymond Hill faf1b15f8d
New revision for dev build 2024-09-09 10:55:57 -04:00
Raymond Hill 52dee35325
Properly reflect whether `ipaddress=` is supported 2024-09-09 10:54:47 -04:00
Raymond Hill 41c96690a5
Make Firefox dev build auto-update 2024-09-09 10:06:34 -04:00
Raymond Hill 7732df1dbd
New revision for dev build 2024-09-09 09:51:45 -04:00
Raymond Hill 2cb2ee8446
Update changelog 2024-09-09 09:51:24 -04:00
Raymond Hill c6dedd253f
New static network filter option `ipaddress=`
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.

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.

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.

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.

Example:

  *$script,ipaddress=93.184.215.14
2024-09-09 09:35:23 -04:00
Raymond Hill 20115697e5
Add ability to quote static network option values
For the sake of convenience for filter list maintainers, this commit
add ability to quote static network option values, so as to avoid the
need to escape commas when parser ambiguity arises.

The quotes can be `"`, `'`, or backticks.

Example, the following filter requires escaping commas:

  example.com$xhr,replace=/"loremIpsum.*?([A-Z]"\}|"\}{2\,4})\}\]\,//,1p

Can be now rewritten with no need to escape when using quotes:

  example.com$xhr,replace='/"loremIpsum.*?([A-Z]"\}|"\}{2,4})\}\],//',1p
2024-09-08 10:01:13 -04:00
Raymond Hill 1b464f75cc
Fix spurious browser error at the console 2024-09-07 16:47:43 -04:00
Raymond Hill bec5d53ce0
[mv3] Attempt at mitigation for when "internal error" occurs
Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/199
2024-09-06 09:31:17 -04:00
Raymond Hill 08e5bffc76
Make Firefox dev build auto-update 2024-09-05 15:01:24 -04:00
Raymond Hill 8981d3e7fe
New revision for dev build 2024-09-05 14:52:19 -04:00
Raymond Hill 901b4ad061
Import changes from https://github.com/gorhill/uBlock/pull/3924 2024-09-05 14:51:47 -04:00
Imre Eilertsen 8631b955bf
Maintenance for the Serbo-Croatian Filters section (#3924)
* Maintenance for the Serbo-Croatian Filters section

* Implemented the request to move to contentURLs

I sure I hope I understood the request correctly, or things would get slightly awkward for me.
2024-09-05 14:49:32 -04:00
Raymond Hill 60a009c530
Further improve `prevent-fetch` scriptlet 2024-09-05 11:17:36 -04:00
Raymond Hill 1dc09b6217
Make Firefox dev build auto-update 2024-09-04 11:56:02 -04:00
Raymond Hill ae9acbf521
New revision for dev build 2024-09-04 11:37:35 -04:00
Raymond Hill f4a75ccd80
Update changelog 2024-09-04 11:37:14 -04:00
Raymond Hill e8202af11d
Improve `prevent-fetch` scriptlet
- Add support for negated matches
- Log caller's arguments when verbose logging is enabled
2024-09-04 11:32:26 -04:00
Raymond Hill 89f02098fd
Apply CSP/PP injections to `object` resources
Related feedback:
https://old.reddit.com/r/uBlockOrigin/comments/1f84tc5/
2024-09-04 11:28:45 -04:00
Raymond Hill 22fb9c4d63
Make Firefox dev build auto-update 2024-09-03 12:01:04 -04:00
Raymond Hill 08ed4b4ed8
New revision for dev build 2024-09-03 11:19:13 -04:00
Raymond Hill 6e426aeac3
Update changelog 2024-09-03 11:18:52 -04:00