From e1cdeaa188743ae15a8baabcd09012b98d7feabb Mon Sep 17 00:00:00 2001 From: Pranjal Jumde Date: Thu, 28 Mar 2019 12:21:17 -0700 Subject: [PATCH] Issue 3920: Proxy requests for resources from storage.googleapis.com through the crlset redirector --- .../net/brave_static_redirect_network_delegate_helper.cc | 9 +++++++++ common/network_constants.cc | 3 +++ common/network_constants.h | 1 + 3 files changed, 13 insertions(+) diff --git a/browser/net/brave_static_redirect_network_delegate_helper.cc b/browser/net/brave_static_redirect_network_delegate_helper.cc index e6784130b689..3cb3fe8fa376 100644 --- a/browser/net/brave_static_redirect_network_delegate_helper.cc +++ b/browser/net/brave_static_redirect_network_delegate_helper.cc @@ -26,6 +26,8 @@ int OnBeforeURLRequest_StaticRedirectWork( URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS, kCRLSetPrefix2); static URLPattern crlSet_pattern3( URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS, kCRLSetPrefix3); + static URLPattern crlSet_pattern4( + URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS, kCRLSetPrefix4); static URLPattern crxDownload_pattern( URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS, kCRXDownloadPrefix); @@ -68,6 +70,13 @@ int OnBeforeURLRequest_StaticRedirectWork( return net::OK; } + if (crlSet_pattern4.MatchesURL(ctx->request_url)) { + replacements.SetSchemeStr("https"); + replacements.SetHostStr("crlsets.brave.com"); + ctx->new_url_spec = ctx->request_url.ReplaceComponents(replacements).spec(); + return net::OK; + } + #if !defined(NDEBUG) GURL gurl = ctx->request_url; static std::vector allowed_patterns({ diff --git a/common/network_constants.cc b/common/network_constants.cc index 39337eb98d2e..2761374ba6bc 100644 --- a/common/network_constants.cc +++ b/common/network_constants.cc @@ -32,6 +32,9 @@ const char kCRLSetPrefix2[] = "*://*.gvt1.com/edgedl/release2/chrome_component/*crl-set*"; const char kCRLSetPrefix3[] = "*://www.google.com/dl/release2/chrome_component/*crl-set*"; +const char kCRLSetPrefix4[] = + "*://storage.googleapis.com/update-delta/hfnkpimlhhgieaddgfemjhofmfblmnib" + "/*crxd"; const char kGoogleTagManagerPattern[] = "https://www.googletagmanager.com/gtm.js"; const char kGoogleTagServicesPattern[] = diff --git a/common/network_constants.h b/common/network_constants.h index 399b09f1ebfa..094139b105dd 100644 --- a/common/network_constants.h +++ b/common/network_constants.h @@ -26,6 +26,7 @@ extern const char kSafeBrowsingPrefix[]; extern const char kCRLSetPrefix1[]; extern const char kCRLSetPrefix2[]; extern const char kCRLSetPrefix3[]; +extern const char kCRLSetPrefix4[]; extern const char kTwitterPattern[]; extern const char kTwitterReferrer[]; extern const char kTwitterRedirectURL[];