uBlockOrigin / uBlock-issues

This is the community-maintained issue tracker for uBlock Origin
https://github.com/gorhill/uBlock
926 stars 77 forks source link

Add queryjump to redirect url #3206

Closed Yuki2718 closed 2 weeks ago

Yuki2718 commented 5 months ago

Prerequisites

I tried to reproduce the issue when...

Description

Mentioned in https://github.com/uBlockOrigin/uBlock-issues/issues/760#issuecomment-720079511 https://github.com/uBlockOrigin/uBlock-issues/issues/2476#issuecomment-1443552457 and now it should be possible to implement as a trusted network filter modifier. It's similar to $uritransform except that this should redirect to different domain and complements href-sanitizer. Maybe $to or something can be combined to restrict the domain to redirect rather than always blindly trust the url in parameter. Though the original context was about shortners, I rather want to use this to automate skip of strict-block page which is currently possible only by manual click.

A specific URL where the issue occurs.

`https://ouo.io/s/BulJXu78?s=http://hackstore.link/alg2i`

Steps to Reproduce

NA

Expected behavior

NA

Actual behavior

NA

uBO version

1.57.0

Browser name and version

Not relevant

Operating System and version

Windows 10

garry-ut99 commented 5 months ago

Mentioned in (...)

Here too:

it was declined in the past, but yes, it then had been mentioned to be reconsidered over time as per : https://github.com/uBlockOrigin/uBlock-issues/issues/1784#issuecomment-991645988

gorhill commented 2 weeks ago

Test cases:


Filters:

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

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

Navigated to: https://example.org/


Filter:

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

Navigate to https://example.com/path/to/tracker?url=https%3A%2F%2Fexample.org%2Fpath%2Fto%2Ftracker%3Fto%3Dhttps%253A%252F%252Fgithub.com%252F

Navigated to: https://github.com/


Filter:

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

Navigate to https://example.com/path/to/tracker?url=https%3A%2F%2Fexample.org%2Fpath%2Fto%2Ftracker

Navigated to https://example.com/path/to/tracker?url=https%3A%2F%2Fexample.org%2Fpath%2Fto%2Ftracker

Note: No skip occurred since not all extraction directives could be fulfilled

uBlock-user commented 2 weeks ago

For https://ouo.io/s/BulJXu78?s=http://hackstore.link/alg2i Filter - ||ouo.io/s/*$urlskip=?s

Capture

krystian3w commented 2 weeks ago

Spaces before "?" are needed?

gorhill commented 1 week ago

Spaces before "?" are needed?

Yes. Commit message:

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

In the future we might want to add base64-decoding or regex extraction (=?url base64), so a separator is needed for the sake of extending the syntax in the future, a space is a good choice since it's never meant to appear in a URL.

hurgir commented 1 week ago

Hi, when I want to reach https://www.evekonomisi.net/git/11770, it redirects to this address

https://rdr.btrck.com/aff_c?offer_id=17&aff_id=1&source=55754&aff_sub=www.evekonomisi.net&aff_sub2=&aff_sub3=hepsiburada.com/philips-ca6700-10-espresso-makinesi-kirec-temizleme-solusyonu-p-HBCV00002YNJSF&aff_sub4=inf-www.evekonomisi.net-7324&aff_sub5=inf&url=https%3a%2f%2f7t4g.adj. st%2fproduct%3fsku%3dHBCV00002YNJSF%26adj_t%3d16v6nskj_16n3rgcj%26publisher_id%3d{transaction_id}%26offer_id%3d{offer_id}%26campaign%3dwinfluenced%26adgroup%3d{aff_sub}{source}%26creative%3d-aff_sub3- %26adj_deep_link%3dhbapp%253a%252f%252fproduct%253fsku%253dHBCV00002YNJSF%2526adj_t%253d16v6nskj_16n3rgcj%2526utm_source%253dwinfluenced%2526utm_medium%253dinfluencer%2526utm_campaign%253dwinfluenced%2526utm_content%253d- aff_sub3-%2526utm_term%253dinfluencer%2526wt_inf%253d{source}%26adj_install_callback%3dhttps%253a%252f%252fwinfluenced-pixel-bs56cx2ajq-ey. a.run. app%252fapi%252fpixel%252fcallback%252finstall%253fevent_type%253dInstall%2526linkid%253d95O2L4G8A2%2526ltoken%253d16v6nskj_16n3rgcj%2526app_id%253d%7Bapp_id%7D%2526offer_id%253d17%2526advertiser_id%253d{advertiser_id}%2526click_id%253d{transaction_id}%2526app_name%253d%7Bapp_name%7D%2526app_version%253d%7Bapp_version%7D%2526store%253d%7Bstore%7D%2526installed_at%253d%7Binstalled_at%7D%2526ip_address%253d%7Bip_address%7D%2526country%253d%7Bcountry%7D%2526device_name%253d%7Bdevice_name%7Dc%2526device_type%253d%7Bdevice_type%7D%2526os_name%253d%7Bos_name%7D%2526partner_parameters%253d%7Bpartner_parameters%7D%2526debug%253dtrue%26adj_event_callback_m2ril4_wapyen%3dhttps%253a%252f%252fwinfluenced- pixel-bs56cx2ajq-ey. a.run. app%252fapi%252fpixel%252fcallback%252fconversion%253fevent_type%253dConversion%2526linkid%253d95O2L4G8A2%2526ltoken%253d16v6nskj_16n3rgcj%2526etoken%253dm2ril4_wapyen%2526offer_id%253d%257bofferId%257d%2526advertiser_id%253d{advertiser_id}%2526app_id%253d%7Bapp_id%7D%2526click_id%253d{transaction_id}%2526ip_address%253d%7Bip_address%7D%2526country%253d%7Bcountry%7D%2526partner_parameters%253d%7Bpartner_parameters%7D%2526revenue_float%253d%7Brevenue_float%7D%2526currency%253d%7Bcurrency%7D%2526reporting_revenue%253d%7Breporting_revenue%7D%2526reporting_currency%253d%7Breporting_currency%7D%2526os_name%253d%7Bos_name%7D%2526debug%253dtrue

I wrote a filter rule as ||rdr.btrck.com/aff_c*$urlskip=?offer_id aff_id source aff_sub aff_sub2 aff_sub3 and I want to reach hepsiburada.com/philips-ca6700-10-espresso-machine-kirec-temizleme-solusyonu-p-HBCV00002YNJSF

stephenhawk8054 commented 1 week ago

I think the parameter value should be a valid string to use with new URL(). The string hepsiburada.com/philips-ca6700-10-espresso-makinesi-kirec-temizleme-solusyonu-p-HBCV00002YNJSF is not a valid string for URL, i.e

new URL("hepsiburada.com/philips-ca6700-10-espresso-machine-kirec-temizleme-solusyonu-p-HBCV00002YNJSF")

will return error, so no, you can't use urlskip in this case.

hurgir commented 1 week ago

So what kind of filter rule should I write for this?

gorhill commented 1 week ago

||rdr.btrck.com/aff_c*$urlskip=?offer_id aff_id source aff_sub aff_sub2 aff_sub3

That is not a valid urlskip filter, it doesn't match what the documentation says how it works. Looks like you want to extract the URL from the aff_sub3 parameter; offer_id, aff_id, source, aff_sub, aff_sub2 are not valid extraction directives. This would be the proper filter:

||rdr.btrck.com/aff_c?$urlskip=?aff_sub3

However as @stephenhawk8054 pointed out, the extracted string is not a valid URL as per URL API, so it does not work in the end.

I do think it should work though, so I will see what can be done about it.

gorhill commented 1 week ago

In the next dev build, this should work:

||rdr.btrck.com/aff_c?$urlskip=?aff_sub3 +https
garry-ut99 commented 1 week ago

Works fine for me (Firefox & Chromium).