Skip to content

Commit

Permalink
Merge pull request #11917 from brave/linh-replace-crlsets-with-redire…
Browse files Browse the repository at this point in the history
…ctor

Replace crlsets with redirector
  • Loading branch information
linhkikuchi authored Jan 21, 2022
2 parents 29fec2f + 9af9f90 commit c215ec6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion browser/net/brave_network_audit_allowed_lists.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ constexpr const char* kAllowedUrlProtocols[] = {
constexpr const char* kAllowedUrlPrefixes[] = {
// allowed because it 307's to https://componentupdater.brave.com
"https://componentupdater.brave.com/service/update2",
"https://crlsets.brave.com/",
"https://crxdownload.brave.com/crx/blobs/",

// Omaha/Sparkle
Expand Down Expand Up @@ -68,6 +67,7 @@ constexpr const char* kAllowedUrlPrefixes[] = {

// Other
"https://brave-core-ext.s3.brave.com/",
"https://dict.brave.com/",
"https://go-updater.brave.com/",
"https://p3a.brave.com/",
"https://p3a-json.brave.com/",
Expand Down
8 changes: 4 additions & 4 deletions browser/net/brave_static_redirect_network_delegate_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,28 +129,28 @@ int OnBeforeURLRequest_StaticRedirectWorkForGURL(

if (crlSet_pattern1.MatchesURL(request_url)) {
replacements.SetSchemeStr("https");
replacements.SetHostStr("crlsets.brave.com");
replacements.SetHostStr("redirector.brave.com");
*new_url = request_url.ReplaceComponents(replacements);
return net::OK;
}

if (crlSet_pattern2.MatchesURL(request_url)) {
replacements.SetSchemeStr("https");
replacements.SetHostStr("crlsets.brave.com");
replacements.SetHostStr("redirector.brave.com");
*new_url = request_url.ReplaceComponents(replacements);
return net::OK;
}

if (crlSet_pattern3.MatchesURL(request_url)) {
replacements.SetSchemeStr("https");
replacements.SetHostStr("crlsets.brave.com");
replacements.SetHostStr("redirector.brave.com");
*new_url = request_url.ReplaceComponents(replacements);
return net::OK;
}

if (crlSet_pattern4.MatchesURL(request_url)) {
replacements.SetSchemeStr("https");
replacements.SetHostStr("crlsets.brave.com");
replacements.SetHostStr("redirector.brave.com");
*new_url = request_url.ReplaceComponents(replacements);
return net::OK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST(BraveStaticRedirectNetworkDelegateHelperTest, ModifyCRLSet1) {
"https://dl.google.com/release2/chrome_component/AJ4r388iQSJq_4819/"
"4819_all_crl-set-5934829738003798040.data.crx3");
const GURL expected_url(
"https://crlsets.brave.com/release2/chrome_component/"
"https://redirector.brave.com/release2/chrome_component/"
"AJ4r388iQSJq_4819/4819_all_crl-set-5934829738003798040.data.crx3");

auto request_info = std::make_shared<brave::BraveRequestInfo>(url);
Expand All @@ -60,7 +60,7 @@ TEST(BraveStaticRedirectNetworkDelegateHelperTest, ModifyCRLSet2) {
"chrome_component/AJ4r388iQSJq_4819/4819_all_crl-set-5934829738003798040"
".data.crx3");
const GURL expected_url(
"https://crlsets.brave.com/edgedl/release2/chrome_compone"
"https://redirector.brave.com/edgedl/release2/chrome_compone"
"nt/AJ4r388iQSJq_4819/4819_all_crl-set-5934829738003798040.data.crx3");

auto request_info = std::make_shared<brave::BraveRequestInfo>(url);
Expand All @@ -72,10 +72,12 @@ TEST(BraveStaticRedirectNetworkDelegateHelperTest, ModifyCRLSet2) {

TEST(BraveStaticRedirectNetworkDelegateHelperTest, ModifyCRLSet3) {
const GURL url(
"https://www.google.com/dl/release2/chrome_component/LLjIBPPmveI_4988/"
"https://www.google.com/dl/release2/chrome_component/"
"LLjIBPPmveI_4988/"
"4988_all_crl-set-6296993568184466307.data.crx3");
const GURL expected_url(
"https://crlsets.brave.com/dl/release2/chrome_component/LLjIBPPmveI_4988/"
"https://redirector.brave.com/dl/release2/chrome_component/"
"LLjIBPPmveI_4988/"
"4988_all_crl-set-6296993568184466307.data.crx3");

auto request_info = std::make_shared<brave::BraveRequestInfo>(url);
Expand Down Expand Up @@ -113,7 +115,7 @@ TEST(BraveStaticRedirectNetworkDelegateHelperTest, ModifyCRLSet1_http) {
"http://dl.google.com/release2/chrome_component/AJ4r388iQSJq_4819/"
"4819_all_crl-set-5934829738003798040.data.crx3");
const GURL expected_url(
"https://crlsets.brave.com/release2/chrome_component/"
"https://redirector.brave.com/release2/chrome_component/"
"AJ4r388iQSJq_4819/4819_all_crl-set-5934829738003798040.data.crx3");

auto request_info = std::make_shared<brave::BraveRequestInfo>(url);
Expand All @@ -129,7 +131,7 @@ TEST(BraveStaticRedirectNetworkDelegateHelperTest, ModifyCRLSet2_http) {
"chrome_component/AJ4r388iQSJq_4819/4819_all_crl-set-5934829738003798040"
".data.crx3");
const GURL expected_url(
"https://crlsets.brave.com/edgedl/release2/chrome_compone"
"https://redirector.brave.com/edgedl/release2/chrome_compone"
"nt/AJ4r388iQSJq_4819/4819_all_crl-set-5934829738003798040.data.crx3");

auto request_info = std::make_shared<brave::BraveRequestInfo>(url);
Expand All @@ -144,7 +146,8 @@ TEST(BraveStaticRedirectNetworkDelegateHelperTest, ModifyCRLSet3_http) {
"http://www.google.com/dl/release2/chrome_component/LLjIBPPmveI_4988/"
"4988_all_crl-set-6296993568184466307.data.crx3");
const GURL expected_url(
"https://crlsets.brave.com/dl/release2/chrome_component/LLjIBPPmveI_4988/"
"https://redirector.brave.com/dl/release2/chrome_component/"
"LLjIBPPmveI_4988/"
"4988_all_crl-set-6296993568184466307.data.crx3");

auto request_info = std::make_shared<brave::BraveRequestInfo>(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ bool ParseJSON(base::StringPiece json,
{ "name": "brave-today-cdn.brave.com", "mode": "force-https", "policy": "custom", "pins": "brave"},
{ "name": "clients4.brave.com", "mode": "force-https", "policy": "custom", "pins": "brave"},
{ "name": "componentupdater.brave.com", "mode": "force-https", "policy": "custom", "pins": "brave"},
{ "name": "crlsets.brave.com", "mode": "force-https", "policy": "custom", "pins": "brave"},
{ "name": "crxdownload.brave.com", "mode": "force-https", "policy": "custom", "pins": "brave"},
{ "name": "devtools.brave.com", "mode": "force-https", "policy": "custom", "pins": "brave"},
{ "name": "dict.brave.com", "mode": "force-https", "policy": "custom", "pins": "brave"},
{ "name": "extensionupdater.brave.com", "mode": "force-https", "policy": "custom", "pins": "brave"},
{ "name": "gaia.brave.com", "mode": "force-https", "policy": "custom", "pins": "brave"},
{ "name": "go-updater.brave.com", "mode": "force-https", "policy": "custom", "pins": "brave"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index 51c061d3bd117c926b74a10deab37d3a694e808b..1ba88c9ae7b4b027b9d63277b2685b1d

static const char kDownloadServerUrl[] =
- "https://redirector.gvt1.com/edgedl/chrome/dict/";
+ "https://crlsets.brave.com/edgedl/chrome/dict/";
+ "https://dict.brave.com/edgedl/chrome/dict/";

return GURL(std::string(kDownloadServerUrl) +
base::ToLowerASCII(bdict_file));

0 comments on commit c215ec6

Please sign in to comment.