forked from brave/brave-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strip referrer header in xorigin requests from .onion (fixes brave/br…
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* Copyright 2021 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* 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 \ | ||
if (!same_origin && base::EndsWith(original_referrer.host_piece(), ".onion", \ | ||
base::CompareCase::INSENSITIVE_ASCII)) { \ | ||
policy = ReferrerPolicy::NO_REFERRER; \ | ||
} | ||
|
||
#include "../../../../net/url_request/url_request_job.cc" | ||
#undef BRAVE_COMPUTE_REFERRER_FOR_POLICY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc | ||
index b2458b8037589a46fd86af21f79fb7ac13308b5f..d508eff7345937d6ee7aefd6d395e26f0b8f3801 100644 | ||
--- a/net/url_request/url_request_job.cc | ||
+++ b/net/url_request/url_request_job.cc | ||
@@ -316,6 +316,7 @@ GURL URLRequestJob::ComputeReferrerForPolicy( | ||
|
||
bool same_origin = url::Origin::Create(original_referrer) | ||
.IsSameOriginWith(url::Origin::Create(destination)); | ||
+ BRAVE_COMPUTE_REFERRER_FOR_POLICY | ||
|
||
if (same_origin_out_for_metrics) | ||
*same_origin_out_for_metrics = same_origin; |