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

Remove YouTube and Instagram share ID parameters from URLs #21255

Merged
merged 6 commits into from
Jan 3, 2024

Conversation

fmarier
Copy link
Member

@fmarier fmarier commented Dec 5, 2023

Fixes brave/brave-browser#34719 and brave/brave-browser#35094

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

  1. In a new browser profile with Shields set to normal adblocking (not aggressive).
  2. Open the network tab of the devtools.
  3. Paste https://www.youtube.com/watch?v=dQw4w9WgXcQ&si=YjziZuccJeIE-b6z in the URL bar.
  4. Filter for just document requests and ensure that the 200 OK request (ignore the 200 Internal Redirect request) does not include the si parameter.
  5. Delete the existing browser profile and create a new one.
  6. Repeat the test with https://youtu.be/watch?v=dQw4w9WgXcQ&si=YjziZuccJeIE-b6z.
  7. Repeat the test with https://www.instagram.com/p/C1nNxSbsAzk/?utm_source=ig_web_button_share_sheet&igsh=ZDNl...IxNw== confirming that the igsh parameter is only present in Internal Redirect requests.

Here's what it looks like before the change in this PR:
Screenshot from 2023-12-05 13-29-23

and here's the new expected result as of this PR:
Screenshot from 2023-12-05 16-47-58
Screenshot from 2023-12-05 16-48-04

The youtu.be URL will now show a 303 Internal Redirect instead of a 303 See Other:
Screenshot from 2023-12-18 15-25-16

Note: this test will only work the first time. You need to delete the profile or clear all data before testing this otherwise service workers will interfere with the requests.

@fmarier fmarier requested a review from ryanbr December 5, 2023 21:32
@fmarier fmarier self-assigned this Dec 5, 2023
Copy link
Collaborator

@ryanbr ryanbr left a comment

Choose a reason for hiding this comment

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

Would it be safer to limit too www. ? would it need to apply to m.youtube.com, music.youtube.com, tv.youtube.com ?

@fmarier
Copy link
Member Author

fmarier commented Dec 8, 2023

Would it be safer to limit too www. ? would it need to apply to m.youtube.com, music.youtube.com, tv.youtube.com ?

It automatically includes subdomains. I've added a comment to that effect in the PR.

@fmarier fmarier marked this pull request as draft December 8, 2023 19:08
@fmarier fmarier marked this pull request as ready for review December 18, 2023 23:10
@fmarier fmarier requested a review from iefremov as a code owner December 18, 2023 23:10
@github-actions github-actions bot added the CI/run-network-audit Run network-audit label Dec 21, 2023
// https://example.com/index.php and from http://www.example.com/ for
// example.
static const auto kScopedQueryStringTrackers =
std::map<std::string_view, std::vector<std::string_view>>({
Copy link
Contributor

Choose a reason for hiding this comment

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

probably with std::array we can keep the whole thing constexpr

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to do this, but I wasn't able to make it work as a constexpr with an std::array because the size of the array is variable.

@fmarier fmarier changed the title Remove YouTube's si URL parameter from URLs Remove YouTube and Instagram share ID parameters from URLs Jan 3, 2024
@fmarier fmarier added this to the 1.63.x - Nightly milestone Jan 3, 2024
@fmarier fmarier merged commit 7e08b57 into master Jan 3, 2024
18 checks passed
@fmarier fmarier deleted the youtube-si-34719 branch January 3, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/run-network-audit Run network-audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove YouTube's si URL parameter from URLs
4 participants