-
Notifications
You must be signed in to change notification settings - Fork 900
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
base: master
Are you sure you want to change the base?
Conversation
…`domainURL` is stripping `m`, `mobile`, and `www` subdomains which can cause our check to miss incorrectly.
…prove unit test speed.
} | ||
} | ||
|
||
class NavigationDelegate: NSObject, WKNavigationDelegate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: private
access control
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b998fd1
// await load of html | ||
await fulfillment(of: [expectation], timeout: 1) | ||
|
||
guard let result = try await webView.evaluateJavaScript("window.origin") as? String else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported by reviewdog 🐶
[semgrep] evaluateJavaScript usages should be vet by the security-team.
References:
- https://github.com/brave/brave-browser/wiki/Security-reviews (point 13)
Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/client/brave-execute-script-ios.yaml
Cc @stoletheminerals @bridiver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used in a unit test only to fetch window.origin
value returned from WKWebView
/ WebKit and verify against our helper.
components.scheme = self.scheme | ||
components.port = self.port | ||
components.host = self.host | ||
return components.url ?? self |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported by reviewdog 🐶
[semgrep] evaluateJavaScript usages should be vet by the security-team.
References:
- https://github.com/brave/brave-browser/wiki/Security-reviews (point 13)
Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/client/brave-execute-script-ios.yaml
Cc @stoletheminerals @bridiver
FrameCheckWrapper.js
failing due to therequiredHref
being stripped ofm
,mobile
, andwww
subdomains.Resolves brave/brave-browser#43454
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
0:00/0:06
/0:00:0:15
timestamps shown before video plays)