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

fix(privacy): FrameCheckWrapper.js given incorrect value for url comparison #27320

Merged
merged 5 commits into from
Jan 30, 2025

Conversation

StephenHeaps
Copy link
Collaborator

@StephenHeaps StephenHeaps commented Jan 22, 2025

  • Some scriptlets are failing to execute due to the comparison in FrameCheckWrapper.js failing due to the requiredHref being stripped of m, mobile, and www subdomains.

Resolves brave/brave-browser#43454

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 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. Play some videos Shields up on YouTube
  2. Verify no ads are displayed or metadata shown (0:00/0:06 / 0:00:0:15 timestamps shown before video plays)

@StephenHeaps StephenHeaps added CI/skip-android Do not run CI builds for Android CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-windows-x64 Do not run CI builds for Windows x64 CI/skip-macos-arm64 Do not run CI builds for macOS arm64 labels Jan 22, 2025
@StephenHeaps StephenHeaps self-assigned this Jan 22, 2025
@StephenHeaps StephenHeaps marked this pull request as ready for review January 23, 2025 15:47
@StephenHeaps StephenHeaps requested a review from a team as a code owner January 23, 2025 15:47
}
}

class NavigationDelegate: NSObject, WKNavigationDelegate {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: private access control

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b998fd1

components.scheme = self.scheme
components.port = self.port
components.host = self.host
return components.url ?? self
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't URL.origin.url aka URLOrigin(url: self).url already do this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Similar. I would need to drop trailing slash but I believe with that either could be used.

Copy link
Contributor

@Brandon-T Brandon-T Jan 24, 2025

Choose a reason for hiding this comment

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

For this: http://Дом.com what does this return as the origin in both JS and URLComponents?
If it returns the same, then it's all good.

Copy link
Contributor

@Brandon-T Brandon-T Jan 24, 2025

Choose a reason for hiding this comment

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

It seems to work fine in both. URLComponents correctly punycodes the domain.

image image

LGTM.

Copy link
Collaborator Author

@StephenHeaps StephenHeaps Jan 24, 2025

Choose a reason for hiding this comment

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

http://Дом.ru/ will output http://xn--d1aqf.ru
http://Дoм.ru/ will output http://xn--o-gtbz.ru

Added in a7628ea

// await load of html
await fulfillment(of: [expectation], timeout: 2)

guard let result = try await webView.evaluateJavaScript("window.origin") as? String else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Chromium major version is behind target branch (132.0.6834.83 vs 133.0.6943.27). Please rebase.

@github-actions github-actions bot added the chromium-version-mismatch The Chromium version on the PR branch does not match the version on the target branch label Jan 27, 2025
@StephenHeaps StephenHeaps force-pushed the bugfix/frame-check-wrapper-youtube branch from a7628ea to b109763 Compare January 27, 2025 18:57
@github-actions github-actions bot removed the chromium-version-mismatch The Chromium version on the PR branch does not match the version on the target branch label Jan 27, 2025
@StephenHeaps StephenHeaps merged commit c9fc5bd into master Jan 30, 2025
18 checks passed
@StephenHeaps StephenHeaps deleted the bugfix/frame-check-wrapper-youtube branch January 30, 2025 16:16
@github-actions github-actions bot added this to the 1.77.x - Nightly milestone Jan 30, 2025
brave-builds added a commit that referenced this pull request Jan 30, 2025
brave-builds added a commit that referenced this pull request Jan 30, 2025
@brave-builds
Copy link
Collaborator

Released in v1.77.3

@Uni-verse
Copy link
Contributor

Verified on iPhone 12 running iOS 18.2 using version 1.77 (3)

example example
IMG_8520 IMG_8521

StephenHeaps pushed a commit that referenced this pull request Jan 30, 2025
kjozwiak pushed a commit that referenced this pull request Jan 31, 2025
…arison (uplift to 1.76.x) (#27419)

Uplift of #27320 (squashed) to beta
kjozwiak pushed a commit that referenced this pull request Jan 31, 2025
…arison (uplift to 1.75.x) (#27420)

Uplift of #27320 (squashed) to release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/skip-android Do not run CI builds for Android CI/skip-macos-arm64 Do not run CI builds for macOS arm64 CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-windows-x64 Do not run CI builds for Windows x64
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scriptlets wrapper given incorrect value for url comparison
8 participants