-
Notifications
You must be signed in to change notification settings - Fork 887
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
Strip referrer and origin headers in xorigin requests from a .onion #10760
Conversation
The extra patches are unfortunate, but I could not find a way to get our existing hooks to cover all of the test cases in my test page. Note that I am planning to upstream (at least) the referrer patch into the Referrer Policy spec and then Chromium, given that the |
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#define BRAVE_COMPUTE_REFERRER_FOR_POLICY \ |
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.
why don't we do this in MaybeChangeReferrer
in brave_shields_util.cc
?
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.
Because it doesn't cover all cases,sadly. That was my first attempt, but none of our existing hooks were even called in the case of a redirected CORS request for example (test case #6 on my test page).
Changing this function also takes care of the Origin
header in most cases (though not the CORS ones).
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.
if it doesn't cover all cases, do we have a problem with the referrer capping that we do in MaybeChangeReferrer?..
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.
We might, I haven't gotten around to testing that yet.
4ef37e0
to
e04ea51
Compare
e04ea51
to
3253526
Compare
url::Origin::Create(request_.url))) { \ | ||
request_.headers.SetHeader(net::HttpRequestHeaders::kOrigin, \ | ||
url::Origin().Serialize()); \ | ||
} else /* NOLINT */ |
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.
Needed, otherwise the linter complains about a missing brace.
3253526
to
088cbb9
Compare
088cbb9
to
ffa2c9b
Compare
If the fix is not super urgent we should invest into a browsertest, the url loader patch looks pretty fragile |
15bf75c
to
fe3b682
Compare
fe3b682
to
0f3e7cd
Compare
@iefremov I have added a browsertest which covers all of the test cases I have manually tested. Could you please review again? |
0f3e7cd
to
030bf22
Compare
030bf22
to
5e415ed
Compare
Verification PASSED on
|
Resolves brave/brave-browser#18071
Security report: https://hackerone.com/reports/1337624
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
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: