Skip to content

Conversation

ghostwords
Copy link
Member

@ghostwords ghostwords commented Jul 14, 2023

Fixes #2866, fixes #2900, fixes #2543, fixes #2719.

This fixes cleaning links in image search, Google Docs, Gmail and Google Maps, as well as links added after scrolling the search results page.

Often the link destination is replaced with a redirect URL in response to interaction with the link. Sometimes we catch this mutation in the content script and fix the link in time. Sometimes the page uses a more complicated approach to covertly open a redirect URL at the last moment, which we don't catch in the content script. We work around these cases by redirecting the redirect request to the expected destination in the network layer.

We still want to use a content script to ensure users can copy/paste clean link URLs, and to avoid an unnecessary redirect.

We no longer try to prevent links from triggering /gen_204 requests in the content scripts, but rather block all /gen_204 ping/beacon requests in the network layer.

Testing notes

✔️: wrapped links that we fix in the content script
😐: more advanced (window.open()-based) wrapping that we handle via the network redirect fallback

browser →
site ↓
Chrome Firefox Firefox for Android
text search no href wrapping ✔️
links wrapped on interaction
✔️
image search 😐 ✔️
links wrapped on interaction,
content script unwraps but too late for navigation
😐 ✔️
links wrapped on interaction,
content script unwraps but too late for navigation
✔️
"lite" version
Docs
example
doc body links: 😐
comment links: ✔️
doc body links: 😐
comment links: ✔️
✔️
/mobilebasic version with double-wrapped (??) links
Sheets
example
😐 😐 ✔️
/htmlview version
Gmail 😐 😐 no href wrapping or window opening trickery
Maps 😐 😐 ✔️

Country code TLDs (e.g. google.co.jp): Same as above, but our content script should still successfully handle country TLD-wrapped links (www.google.co.jp/url?), and our network redirect fallback should handle the country TLD redirect.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei
@ghostwords ghostwords added the first-party relating to first-party scripts label Jul 14, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei
To get the "basic" version of a Google Docs spreadsheet,
replace the trailing `/edit` with `/htmlview` in the URL.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei
@ghostwords ghostwords force-pushed the fix-google-link-unwrapping branch from 942dd01 to f527224 Compare July 17, 2023 19:12

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei
Instead of trying to prevent /gen_204 requests by stripping attributes
and trying to capture mouse events, let's just block them.

The previous approach breaks functionality and fails to consistenly
prevent tracking.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ghostwords Alexei
@ghostwords ghostwords force-pushed the fix-google-link-unwrapping branch from 331599a to 9958673 Compare July 21, 2023 15:40
Copy link

@zoracon zoracon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a few comments to collapse some conditions. Otherwise the rest is clear to me.

@ghostwords ghostwords merged commit d0cc755 into master Aug 8, 2023
@ghostwords ghostwords deleted the fix-google-link-unwrapping branch August 8, 2023 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first-party relating to first-party scripts
Projects
None yet
2 participants