sblask-webextensions / webextension-skip-redirect

Some web pages use intermediary pages before redirecting to a final page. This add-on tries to extract the final url from the intermediary url and goes there straight away if successful.
https://addons.mozilla.org/firefox/addon/skip-redirect/
MIT License
481 stars 45 forks source link

Parsing of destination URL breaks destinations with URL encoding, such as Microsoft Teams links from Google redirect #365

Open wesinator opened 2 months ago

wesinator commented 2 months ago

New Issue Checklist (tick off like this: [x])

What is your browser?

What is your operating system?

Description (please include examples/screenshots where applicable)

Clicking a Microsoft Teams link in a Google Calendar event, skip redirect correctly redirects the request from https://www.google.com/url?q=, but it also automatically runs the equivalent of decodeURIComponent on the destination link, which breaks the Teams landing url, which uses mixed URL encoding in the URL. image

To reproduce:

no-skip list does not mitigate this as the bug happens on the parsing of the destination URL.

Example expected meeting link vs redirected target destination URL:

expected/raw link: (this would be the correct link. this specific link will still show error because it is a made up meeting id) https://teams.microsoft.com/dl/launcher/launcher.html?url=%2F_%23%2Fl%2Fmeetup-join%2F19%3Ameeting_Zxbfkjdkjfdjfkjjkfjfdjguruuutuggtjgkkjtkjtkjtkj%40thread.v2%2F0%3Fcontext%3D%257b%2522Tid%2522%253a%2522988924aeff9-e2f8-413f-ac53-01ac1ce99323%2522%252c%2522Oid%2522%253a%25924aeff9-e2f8-413f-ac53-01ac1ce99323%2522%257d%26mc_cid%3Df74e31d565&mc_eid%3Ddf103b679e%26anon%3Dtrue&type=meetup-join&deeplinkId=924aeff9-e2f8-413f-ac53-01ac1ce99323&directDl=true&msLaunch=true&enableMobilePage=true&suppressPrompt=true

redirect destination (decodeURIComponent() on above URL): https://teams.microsoft.com/dl/launcher/launcher.html?url=/_#/l/meetup-join/19:meeting_Zxbfkjdkjfdjfkjjkfjfdjguruuutuggtjgkkjtkjtkjtkj@thread.v2/0?context=%7b%22Tid%22%3a%22924aeff9-e2f8-413f-ac53-01ac1ce99323%22%2c%22Oid%22%3a%22924aeff9-e2f8-413f-ac53-01ac1ce99323%22%7d&mc_cid=f74e31d565&mc_eid=df103b679e&anon=true&type=meetup-join&deeplinkId=924aeff9-e2f8-413f-ac53-01ac1ce99323&directDl=true&msLaunch=true&enableMobilePage=true&suppressPrompt=true

The dest URL is passed through something equivalent to decodeURIComponent (the output of this on the example matches what decodeURIComponent does).

it seems like this might be an issue in maybeDecode?

let me know if there are any questions or if there's something I am missing.