Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google.com #7960

Closed
cantunborn opened this issue Sep 26, 2020 · 55 comments
Closed

google.com #7960

cantunborn opened this issue Sep 26, 2020 · 55 comments

Comments

@cantunborn
Copy link

URL(s) where the issue occurs

https://www.google.com

Describe the issue

When tapping on the search results, first a google URL is opened and then page is redirected to main search result URL.
The link shown after right-clicking (long press on mobile) is also not the URL of search result. This can also be seen in DOM of webpage where the anchor tag a has ping and oncontextmenu (to prevent copying main URL and to replace it with ping URL) attributes which may be considered tracking, but I'm not sure. It definitely is an annoyance since it brings extra redirection and slows down browsing.

Screenshot(s)

I have put screenshots in another issue on adguard filters page AdguardTeam/AdguardFilters#64616.

Versions

  • Browser/version: Firefox Fenix Nightly
  • uBlock Origin version: 1.29.2

Settings

Default settings.

Notes

I bypassed this with google.com##+js(ra, ping|oncontextmenu, a), but it may not be accurate.

@uBlock-user
Copy link
Contributor

uBlock-user commented Sep 26, 2020

Click-tracking is not an issue because hyperlink auditing is disabled by default.

@cantunborn
Copy link
Author

Yes, I can see in the logger that beacon is blocked but the intermediate page still loads albeit as a blank page. Wouldn't you consider it an annoyance atleast?

@liamengland1
Copy link
Contributor

liamengland1 commented Sep 26, 2020

Google rewrites the links in results on mousedown, proxying the URLs through https://www.google.com/url?.... I fix this using the filter google.*##+js(set, rwt, noopFunc).

image

@cantunborn
Copy link
Author

I am talking mainly about mobile devices, try opening any google search result in responsive mode in dev tools.

@uBlock-user
Copy link
Contributor

but the intermediate page still loads albeit as a blank page. Wouldn't you consider it an annoyance atleast?

google.*##+js(ra, onmousedown, a[href][onmousedown]) works for you ?

@cantunborn
Copy link
Author

but the intermediate page still loads albeit as a blank page. Wouldn't you consider it an annoyance atleast?

google.*##+js(ra, onmousedown, a[href][onmousedown]) works for you ?

No, the search results don't have onmousedown attribute on mobile. Take a look at the screenshots I posted on the adguard filters issues page.

@uBlock-user
Copy link
Contributor

uBlock-user commented Sep 26, 2020

@cantunborn try google.*##+js(ra, onmousedown|ping, a[href][onmousedown]\, a[href][ping])

@liamengland1
Copy link
Contributor

liamengland1 commented Sep 26, 2020

Sneaky google

google.ctpacw = {};
google.ctpacw.cm = function(a) {
  a.ping && (a.href = a.ping, a.removeAttribute("ping"))
};

@cantunborn
Copy link
Author

Sneaky google

google.ctpacw = {};
google.ctpacw.cm = function(a) {
  a.ping && (a.href = a.ping, a.removeAttribute("ping"))
};

This is what I was talking about 😃.

@cantunborn
Copy link
Author

@cantunborn try google.*##+js(ra, onmousedown|ping, a[href][onmousedown]\, a[href][ping])

Yes it works.

@krystian3w
Copy link
Contributor

krystian3w commented Sep 27, 2020

"\," no need documented on wiki https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-attrjs-?

@gwarser
Copy link
Contributor

gwarser commented Sep 27, 2020

@cantunborn
Copy link
Author

Similar issue in image results, google uses mousedown event listener with JsAction to modify result URL on right-click. Can copy original link using ClearURLs addon's cleaner.

Is it possible to defuse the listener using uBO?

@krystian3w
Copy link
Contributor

krystian3w commented Jan 14, 2021

Maybe not visible in aell or need kill all of group events +js(aeld, mousedown) so have similar bugs to events created with jQuery.

https://github.com/ClearURLs/Addon/blob/6e3ff2247eb084c7fd2ca88d09749a1ef4ef2d43/core_js/google_link_fix.js

@uBlock-user
Copy link
Contributor

uBlock-user commented Jan 14, 2021

You can try www.google.*##+js(ra, jsaction, a[data-ved][jsaction][rel="noopener"][target="_blank"], stay) on uBO dev-build on Chromium/Chrome or www.google.*##+js(aeld, contextmenu) on Chromium/Chrome.

@cantunborn
Copy link
Author

cantunborn commented Jan 14, 2021

www.google.*##+js(aeld, contextmenu) does not work. I can't install dev-build currently, will check other filter when uBO update releases.

@uBlock-user
Copy link
Contributor

Scriptlets will not work on google image search page on Firefox because of https://bugzilla.mozilla.org/show_bug.cgi?id=1267027

@krystian3w
Copy link
Contributor

krystian3w commented Jan 14, 2021

Possible with with Scriptlet Doctor or this:

security.csp.enable false no longer in Firefox

@kotarou3
Copy link

Note that this ends up partially disabling search history (which is technically tracking, but I nevertheless find useful).
Specifically, search history will no longer be able to track which results you clicked on.

I've personally added a filter exception for this filter in my personal list, but leaving a message here in case others come wondering

@stdedos
Copy link

stdedos commented Apr 11, 2021

It also blocks Timeline manipulation from working

uBlock-user added a commit that referenced this issue Apr 11, 2021
@uBlock-user
Copy link
Contributor

replaced with www.google.*##+js(set, rwt, noopFunc), report if you still experience such breakage.

@stdedos
Copy link

stdedos commented Apr 11, 2021

Is it live? Should I update my filter list now and try it?

I had also opted to disable the filter in The Logger (#@#), but I don't find such disable in my filters.
Do I need to do something about it?

@uBlock-user
Copy link
Contributor

Remove the filters you added to counter the filter and force update uBlock Annoyances list.

@stdedos
Copy link

stdedos commented Apr 11, 2021

I didn't add a filter manually, and I cannot find any google entry in My filters

@okiehsch
Copy link
Contributor

Update the uBlock Annoyances list to get the new filter.

@stephenhawk8054
Copy link
Member

https://www.google.com/recaptcha/api2/demo

Captcha works normally for me on this site. What do you mean?

@Daxy7
Copy link

Daxy7 commented May 12, 2023

I mean uBO puts js on where link tracking doesn't apply
image

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented May 12, 2023

Yes, currently scriptlets can only be applied on domain levels. Does it cause any breakages?

@Daxy7
Copy link

Daxy7 commented May 12, 2023

No

@Daxy7
Copy link

Daxy7 commented May 12, 2023

Found occurrence when right clicking an image

2023-05-12.13-27-20-1.mp4

@gwarser
Copy link
Contributor

gwarser commented May 12, 2023

Found occurrence when right clicking an image

Occurrence of what?

@Daxy7
Copy link

Daxy7 commented May 12, 2023

link tracking

@MasterKia
Copy link
Member

@ThreeDeeJay #20833

@MasterKia MasterKia reopened this Nov 23, 2023
@mapx-
Copy link
Contributor

mapx- commented Nov 24, 2023

the original #20833 converted in discussion:

#20846

@mapx- mapx- closed this as completed Nov 24, 2023
@necaran
Copy link

necaran commented Mar 25, 2024

Edit:
I got the rule to prevent rewriting, but It will stop working again once they change the attribute name.

www.google.*##a[data-sb]:remove-attr(data-sb)

The rule stopped working recently.
I found a suspicious function called google.arwt.

www.google.*##+js(set, google.arwt, noopFunc)

But this does not help.
When I dig further I found this (beautified).

window.document.documentElement.addEventListener("mousedown", function(b) {
var c = b.target;
if (!c) return !0;
c = c.closest("a[data-sb]");
if (!c) return !0;
if (0 !== b.button) {
    a: {
        b = c.getAttribute("data-sb");
        var a = void 0 === a ? l : a;
        if (b instanceof d) a = b;
        else {
            for (var g = 0; g < a.length; ++g) {
                var h = a[g];
                if (h instanceof f && h.i(b)) {
                    a = new d(b, e);
                    break a
                }
            }
            a = void 0
        }
    }
    a instanceof d ? a = a instanceof d && a.constructor === d ? a.g : "type_error:SafeUrl" : a = m.test(a) ? a : void 0;void 0 !== a && (c.href = a);c.removeAttribute("data-sb")
}
else "function" ===
    typeof navigator.sendBeacon ? navigator.sendBeacon(c.getAttribute("data-sb"), "") : google.log("", "", c.getAttribute("data-sb"));
return !0
}, !0);

I tried aeld.js, but somehow it does not always work.
Besides, I am not sure if it breaks anything.

www.google.*##+js(aeld, mousedown)

Fortunately, my userscript still works.

new MutationObserver(m=>{
for(let r of m) {
	let _ = r.target.getAttribute("href").match(/[\?&]url=([^&]+)/);
	_ && r.target.setAttribute("href", decodeURIComponent(_[1]));
}
}).observe(document.body, {subtree:true,attributeFilter:["href"]});

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Mar 27, 2024

@gorhill Sorry, can you take a look? I can reproduce the issue where google.com##+js(aeld, mousedown) cannot defuse the above event listener.


In the mean time, I think we can use

www.google.*##a[data-sb^="/url?"]:remove-attr(data-sb)

?

@uBlock-user
Copy link
Contributor

Can't repro, www.google.*##+js(set, rwt, noopFunc) still works.

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Mar 27, 2024

I can reproduce in Firefox when right click

image


Maybe sign-in required?

@uBlock-user
Copy link
Contributor

@stephenhawk8054 Need to use -href-cleaner scriptlet for that. The issue is at href=/url?sa=t&source=web&rct=j&opi=89978449&url=https://en.wikipedia.org/wiki/X-Men:_The_Animated_Series&ved=2ahUKEwjWkrSg05OFAxWKk68BHdF0CToQFnoECC0QAQ&usg=AOvVaw1QZ23LbjrlDMGmvRkROWDH attribute

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Mar 27, 2024

That could be another way, before right clicking on that link the element looks like this

<a jsname="UWckNb" href="https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm" data-ved="2ahUKEwijuJvG1ZOFAxWblK8BHSa6DcoQFnoECAYQAQ" data-sb="/url?sa=t&amp;source=web&amp;rct=j&amp;opi=89978449&amp;url=https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm&amp;ved=2ahUKEwijuJvG1ZOFAxWblK8BHSa6DcoQFnoECAYQAQ&amp;usg=AOvVaw1m9pu35nBXRjvT4aqrVBjR"></a>

href is not modified yet, the redirected URL is in data-sb attribute. That's why www.google.*##a[data-sb^="/url?"]:remove-attr(data-sb) works


Hmm... Looks like href-sanitizer kicks in too late after user right-clicking on the link.

@uBlock-user
Copy link
Contributor

uBlock-user commented Mar 27, 2024

That's why www.google.*##a[data-sb^="/url?"]:remove-attr(data-sb) works

Indeed, this fixes up. You should add it.

stephenhawk8054 added a commit that referenced this issue Mar 28, 2024
@necaran
Copy link

necaran commented Mar 28, 2024

Just found a special case where href-sanitizer fails to work.

error

Steps to reproduce:

  1. Start a new profile with Firefox 124.0.1 and install uBlock 1.56.0.
  2. Add the filter: www.google.*##+js(href-sanitizer, #main a[href^="/url?q=http"], ?q)
  3. Disable JavaScript on Google: no-scripting: www.google.com true
  4. Block cookies from Google
  5. Open Console
  6. Search with Google

And there is SecurityError: The operation is insecure.

(
function(name) {
            if ( self.uBO_bcSecret ) { return; }
            const bcSecret = new self.BroadcastChannel(name); // SecurityError: The operation is insecure.

If cookies are allowed, it works just fine under no-scripting mode.

@stephenhawk8054
Copy link
Member

href-sanitizer won't work on desktop. I only set it on mobile

@necaran
Copy link

necaran commented Mar 28, 2024

Sorry for the confusion.
I added it manually it without any condition, and it does work on desktop.
When scripting is disabled for google, it shows the same page as on mobile.

@Daxy7
Copy link

Daxy7 commented Mar 30, 2024

How to truncate URLs like these in Google images?
https://www.google.com/search?q=germ+warfare#vhid=gaG-tD5eCpYK3M&vssid=l

https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.goodreads.com%2Fbook%2Fshow%2F45456916-germ-warfare&psig=AOvVaw09bmaCC2rFflAI7lndt44Q&ust=1711917757128000&source=images&cd=vfe&opi=89978449&ved=0CBIQjRxqFwoTCJiZ5dzsnIUDFQAAAAAdAAAAABAE

which should be
https://www.goodreads.com/book/show/45456916-germ-warfare
https://github.com/uBlockOrigin/uAssets/assets/91396482/05e5cf0d-4c8c-41ad-b7d7-1f80d493b6a5

@gwarser
Copy link
Contributor

gwarser commented Mar 31, 2024

uritransform uBlockOrigin/uBlock-issues#3084

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests