AdguardTeam / Scriptlets

AdGuard scriptlets library
GNU General Public License v3.0
148 stars 29 forks source link

Add new scriptlet — 'href-sanitizer' #327

Closed MasterKia closed 6 months ago

MasterKia commented 1 year ago

Related uBO scriptlet: https://github.com/uBlockOrigin/uBlock-issues/wiki/Resources-Library#href-sanitizerjs-


Related issues/commits: https://github.com/uBlockOrigin/uBlock-issues/issues/2531

https://github.com/gorhill/uBlock/commit/e123256eaf64be19f81eba123970db07b45eb0ae

https://github.com/gorhill/uBlock/commit/56e1d92dbd65e6168620053b1fec4c21c03d664e


It can be used to replace some click tracking links with the actual link. The most notable case is https://www.mozilla.org/en-US/firefox/browsers/mobile/android/ where the "Get it on Google play" button has app.adjust.com tracking link.


Usage so far in uBO lists:

! https://github.com/uBlockOrigin/uBlock-issues/issues/2531#issuecomment-1512373333
mozilla.org##+js(href-sanitizer, a[href^="https://app.adjust.com/"][href*="?redirect="], ?redirect)

! https://www.androidauthority.com/third-party-reddit-apps-statement-3332238/ redirect links
androidauthority.com##+js(href-sanitizer, a[href^="https://androidauth.wpengine.com/wp-json/api/advanced_redirect?ref="], ?ref)

! https://www.pcgamingwiki.com/wiki/Grand_Theft_Auto_V
pcgamingwiki.com##+js(href-sanitizer, a[href^="https://www.dpbolvw.net/click-"][href*="?url="], ?url)
pcgamingwiki.com##+js(href-sanitizer, a[href^="https://greenmangaming.sjv.io/c/"][href*="?u="], ?u)

! https://azrom.net/rom-oppo-a71-cph1717-cph1801-official-firmware-all-repair-file/ timer
azrom.net##+js(href-sanitizer, a[href^="https://azrom.net/"][href*="?url="], ?url)
Dimsday commented 1 year ago

Also example:

! https://vk.com/away.php?to=https%3A%2F%2Fdodo-space.ru%2F ->https://dodo-space.ru/
vk.com##+js(href-sanitizer, a[href^="https://vk.com/away.php"][href*="?to=], ?to)
MasterKia commented 1 year ago

https://github.com/uBlockOrigin/uAssets/blob/48d7ff6aa207cbaf7c6ec0f685ae4518446862f5/filters/privacy.txt#L637-L669

billkewl commented 1 week ago

It would be nice if base64 encoded urls can be decoded like in this extension https://github.com/sblask-webextensions/webextension-skip-redirect/issues/181 maybe as an option for href-sanitizer?

slavaleleka commented 1 week ago

@billkewl could you please file a new issue for the improvement?