-
Notifications
You must be signed in to change notification settings - Fork 1k
13464: Unrestrict referrer hiding for top-level navigations. #7591
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
Conversation
I've updated my test pages for this: |
"X-Brave-Clear-Referer")) { | ||
const_cast<RedirectInfo&>(redirect_info).new_referrer.clear(); | ||
"X-Brave-Cap-Referer")) { | ||
url::Origin referrer = url::Origin::Create( |
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.
Does this take into account HTTPS -> HTTP transitions where the referrer needs to be empty?
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.
huh, good catch - should be fixed now
NavigateDirectlyToPageWithLink(same_origin_url()); | ||
EXPECT_EQ(ExecScriptGetStr(kReferrerScript, contents()), link_url().spec()); | ||
EXPECT_EQ(GetLastReferrer(same_origin_url()), link_url().spec()); | ||
|
||
// Same-site but cross-origin navigations get the original page origin as the | ||
// referrer. | ||
const std::string expected_referrer = link_url().GetOrigin().spec(); | ||
NavigateDirectlyToPageWithLink(same_site_url()); | ||
EXPECT_EQ(ExecScriptGetStr(kReferrerScript, contents()), | ||
link_url().GetOrigin().spec()); |
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.
You could use expected_referrer
here.
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
NavigateDirectlyToPageWithLink(same_origin_url()); | ||
EXPECT_EQ(ExecScriptGetStr(kReferrerScript, contents()), link_url().spec()); | ||
EXPECT_EQ(GetLastReferrer(same_origin_url()), link_url().spec()); | ||
|
||
// Same-site but cross-origin navigations get the original page origin as the | ||
// referrer. | ||
const std::string expected_referrer = link_url().GetOrigin().spec(); | ||
NavigateDirectlyToPageWithLink(same_site_url()); | ||
EXPECT_EQ(ExecScriptGetStr(kReferrerScript, contents()), | ||
link_url().GetOrigin().spec()); | ||
EXPECT_EQ(GetLastReferrer(same_site_url()), link_url().GetOrigin().spec()); |
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.
(and here)
e2e9022
to
15fd25a
Compare
To solve webcompat problems we replace forcing "no-referrer" for cross-site top-level navigations with capping with "strict-origin-when-cross-origin". Fix brave/brave-browser#13464
15fd25a
to
739093e
Compare
@mkarolin please take a look, there are only simple changes |
removed_headers->end(), | ||
"X-Brave-Clear-Referer")) { | ||
const_cast<RedirectInfo&>(redirect_info).new_referrer.clear(); | ||
if (base::Contains(*removed_headers, "X-Brave-Cap-Referer")) { |
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: X-Brave-Cap-Referer
-> ReferRer? (if so, also in browser/net/brave_site_hacks_network_delegate_helper.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.
chromium_src
changes LGTM
@fmarier PTAL |
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.
Looks good to me.
I've added a test plan. Please go through it before merging to make sure we didn't forget anything in the automated tests.
Many thanks @fmarier for the test plan - I've verified everyhing. FWIW, we block |
Thanks for the heads up. Hopefully this will get fixed by brave-experiments/qa-test-pages#1. |
Verification PASSED on
|
To solve webcompat problems we replace forcing "no-referrer"
for cross-site top-level navigations with capping with
"strict-origin-when-cross-origin".
Fix brave/brave-browser#13464
Resolves
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:
Use the following test pages to confirm that all test cases are working as expected: