Skip to content

Commit

Permalink
Merge pull request #1104 from brave/revert-997-crlset_reintroduced
Browse files Browse the repository at this point in the history
Revert "CRLsets reintroduced"
  • Loading branch information
bbondy authored Dec 15, 2018
2 parents d596445 + b1c0dd1 commit 14706a8
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 156 deletions.
34 changes: 0 additions & 34 deletions browser/net/brave_static_redirect_network_delegate_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ int OnBeforeURLRequest_StaticRedirectWork(
GURL::Replacements replacements;
static URLPattern geo_pattern(URLPattern::SCHEME_HTTPS, kGeoLocationsPattern);
static URLPattern safeBrowsing_pattern(URLPattern::SCHEME_HTTPS, kSafeBrowsingPrefix);
static URLPattern crlSet_pattern1(URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS,
kCRLSetPrefix1);
static URLPattern crlSet_pattern2(URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS,
kCRLSetPrefix2);
static URLPattern crxDownload_pattern(URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS,
kCRXDownloadPrefix);

if (geo_pattern.MatchesURL(ctx->request_url)) {
ctx->new_url_spec = GURL(GOOGLEAPIS_ENDPOINT GOOGLEAPIS_API_KEY).spec();
Expand All @@ -33,27 +27,6 @@ int OnBeforeURLRequest_StaticRedirectWork(
return net::OK;
}

if (crxDownload_pattern.MatchesHost(ctx->request_url)) {
replacements.SetSchemeStr("https");
replacements.SetHostStr("crxdownload.brave.com");
ctx->new_url_spec = ctx->request_url.ReplaceComponents(replacements).spec();
return net::OK;
}

if (crlSet_pattern1.MatchesHost(ctx->request_url)) {
replacements.SetSchemeStr("https");
replacements.SetHostStr("crlsets1.brave.com");
ctx->new_url_spec = ctx->request_url.ReplaceComponents(replacements).spec();
return net::OK;
}

if (crlSet_pattern2.MatchesHost(ctx->request_url)) {
replacements.SetSchemeStr("https");
replacements.SetHostStr("crlsets2.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<URLPattern> allowed_patterns({
Expand Down Expand Up @@ -85,16 +58,9 @@ int OnBeforeURLRequest_StaticRedirectWork(
URLPattern(URLPattern::SCHEME_HTTPS, "https://safebrowsing.brave.com/v4/*"),
URLPattern(URLPattern::SCHEME_HTTPS, "https://ssl.gstatic.com/safebrowsing/*"),

//CRLSets
URLPattern(URLPattern::SCHEME_HTTPS, "https://crlsets1.brave.com/*"),
URLPattern(URLPattern::SCHEME_HTTPS, "https://crlsets2.brave.com/*"),

URLPattern(URLPattern::SCHEME_HTTPS, "https://crxdownload.brave.com/*"),

// Will be removed when https://github.com/brave/brave-browser/issues/663 is fixed
URLPattern(URLPattern::SCHEME_HTTPS, "https://www.gstatic.com/*"),
});

// Check to make sure the URL being requested matches at least one of the allowed patterns
bool is_url_allowed = std::any_of(allowed_patterns.begin(), allowed_patterns.end(),
[&gurl](URLPattern pattern) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,70 +68,6 @@ TEST_F(BraveStaticRedirectNetworkDelegateHelperTest, ModifyGeoURL) {
EXPECT_EQ(ret, net::OK);
}

TEST_F(BraveStaticRedirectNetworkDelegateHelperTest, ModifyCRLSet1) {
net::TestDelegate test_delegate;
GURL url("https://dl.google.com/release2/chrome_component/AJ4r388iQSJq_4819/"
"4819_all_crl-set-5934829738003798040.data.crx3");
std::unique_ptr<net::URLRequest> request =
context()->CreateRequest(url, net::IDLE, &test_delegate,
TRAFFIC_ANNOTATION_FOR_TESTS);
std::shared_ptr<brave::BraveRequestInfo>
before_url_context(new brave::BraveRequestInfo());
brave::BraveRequestInfo::FillCTXFromRequest(request.get(), before_url_context);
brave::ResponseCallback callback;
GURL expected_url("https://crlsets1.brave.com/release2/chrome_component/"
"AJ4r388iQSJq_4819/4819_all_crl-set-5934829738003798040.data.crx3");
int ret =
OnBeforeURLRequest_StaticRedirectWork(callback,
before_url_context);
EXPECT_EQ(before_url_context->new_url_spec, expected_url);
EXPECT_EQ(ret, net::OK);
}

TEST_F(BraveStaticRedirectNetworkDelegateHelperTest, ModifyCRLSet2) {
net::TestDelegate test_delegate;
GURL url("https://r2---sn-8xgp1vo-qxoe.gvt1.com/edgedl/release2/chrome_compone"
"nt/AJ4r388iQSJq_4819/4819_all_crl-set-5934829738003798040.data.crx3");
std::unique_ptr<net::URLRequest> request =
context()->CreateRequest(url, net::IDLE, &test_delegate,
TRAFFIC_ANNOTATION_FOR_TESTS);
std::shared_ptr<brave::BraveRequestInfo>
before_url_context(new brave::BraveRequestInfo());
brave::BraveRequestInfo::FillCTXFromRequest(request.get(), before_url_context);
brave::ResponseCallback callback;
GURL expected_url("https://crlsets2.brave.com/edgedl/release2/chrome_compone"
"nt/AJ4r388iQSJq_4819/4819_all_crl-set-5934829738003798040.data.crx3");
int ret =
OnBeforeURLRequest_StaticRedirectWork(callback,
before_url_context);
EXPECT_EQ(before_url_context->new_url_spec, expected_url);
EXPECT_EQ(ret, net::OK);
}

TEST_F(BraveStaticRedirectNetworkDelegateHelperTest, ModifyCRXDownload) {
net::TestDelegate test_delegate;
GURL url("https://clients2.googleusercontent.com/crx/blobs/QgAAAC6zw0qH2DJtn"
"Xe8Z7rUJP1RM6lX7kVcwkQ56ujmG3AWYOAkxoNnIdnEBUz_3z4keVhjzzAF10srsaL7lrntfB"
"IflcYIrTziwX3SUS9i_P-CAMZSmuV5tdQl-Roo6cnVC_GRzKsnZSKm1Q/extension_2_0_67"
"3_0.crx");
std::unique_ptr<net::URLRequest> request =
context()->CreateRequest(url, net::IDLE, &test_delegate,
TRAFFIC_ANNOTATION_FOR_TESTS);
std::shared_ptr<brave::BraveRequestInfo>
before_url_context(new brave::BraveRequestInfo());
brave::BraveRequestInfo::FillCTXFromRequest(request.get(), before_url_context);
brave::ResponseCallback callback;
GURL expected_url("https://crxdownload.brave.com/crx/blobs/QgAAAC6"
"zw0qH2DJtnXe8Z7rUJP1RM6lX7kVcwkQ56ujmG3AWYOAkxoNnIdnEBUz_3z4keVhjzzAF10sr"
"saL7lrntfBIflcYIrTziwX3SUS9i_P-CAMZSmuV5tdQl-Roo6cnVC_GRzKsnZSKm1Q/extens"
"ion_2_0_673_0.crx");
int ret =
OnBeforeURLRequest_StaticRedirectWork(callback,
before_url_context);
EXPECT_EQ(before_url_context->new_url_spec, expected_url);
EXPECT_EQ(ret, net::OK);
}

TEST_F(BraveStaticRedirectNetworkDelegateHelperTest, ModifySafeBrowsingURLV4) {
net::TestDelegate test_delegate;
GURL url("https://safebrowsing.googleapis.com/v4/threatListUpdates:fetch?$req=ChkKCGNocm9taXVtEg02Ni");
Expand Down

This file was deleted.

21 changes: 0 additions & 21 deletions chromium_src/components/component_updater/configurator_impl.cc

This file was deleted.

1 change: 0 additions & 1 deletion common/extensions/extension_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const char brave_rewards_extension_id[] = "jidkidbbcafjabdphckchenhfomhnfma";
const char brave_webtorrent_extension_id[] = "lgjmpdmojkpocjcopdikifhejkkjglho";
const char widevine_extension_id[] = "oimompecagnajdejgnnjijobebaeigek";
const char brave_sync_extension_id[] = "nomlkjnggnifocmealianaaiobmebgil";
const char crl_set_extension_id[] = "hfnkpimlhhgieaddgfemjhofmfblmnib";

const char pdfjs_extension_id[] = "oemmndcbldboiebfnladdacbdfmadadm";
const char pdfjs_extension_name[] = "PDF Viewer (PDF.js)";
Expand Down
1 change: 0 additions & 1 deletion common/extensions/extension_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ extern const char brave_rewards_extension_id[];
extern const char brave_webtorrent_extension_id[];
extern const char widevine_extension_id[];
extern const char brave_sync_extension_id[];
extern const char crl_set_extension_id[];

extern const char pdfjs_extension_id[];
extern const char pdfjs_extension_name[];
Expand Down
3 changes: 0 additions & 3 deletions common/network_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ const char kBraveReferralsHeadersPath[] = "/promo/custom-headers";
const char kBraveReferralsInitPath[] = "/promo/initialize/nonua";
const char kBraveReferralsActivityPath[] = "/promo/activity";

const char kCRXDownloadPrefix[] = "https://clients2.googleusercontent.com/crx/blobs/*crx*";
const char kEmptyDataURI[] = "data:text/plain,";
const char kEmptyImageDataURI[] = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
const char kJSDataURLPrefix[] = "data:application/javascript;base64,";
const char kGeoLocationsPattern[] = "https://www.googleapis.com/geolocation/v1/geolocate?key=*";
const char kSafeBrowsingPrefix[] = "https://safebrowsing.googleapis.com/";
const char kCRLSetPrefix1[] = "https://dl.google.com/release2/chrome_component/*crl-set*";
const char kCRLSetPrefix2[] = "https://*.gvt1.com/edgedl/release2/chrome_component/*crl-set*";
const char kGoogleTagManagerPattern[] = "https://www.googletagmanager.com/gtm.js";
const char kGoogleTagServicesPattern[] = "https://www.googletagservices.com/tag/js/gpt.js";
const char kForbesPattern[] = "https://www.forbes.com/*";
Expand Down
3 changes: 0 additions & 3 deletions common/network_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ extern const char kBraveReferralsHeadersPath[];
extern const char kBraveReferralsInitPath[];
extern const char kBraveReferralsActivityPath[];

extern const char kCRXDownloadPrefix[];
extern const char kEmptyDataURI[];
extern const char kEmptyImageDataURI[];
extern const char kJSDataURLPrefix[];
Expand All @@ -18,8 +17,6 @@ extern const char kGoogleTagServicesPattern[];
extern const char kForbesPattern[];
extern const char kForbesExtraCookies[];
extern const char kSafeBrowsingPrefix[];
extern const char kCRLSetPrefix1[];
extern const char kCRLSetPrefix2[];
extern const char kTwitterPattern[];
extern const char kTwitterReferrer[];
extern const char kTwitterRedirectURL[];
Expand Down

0 comments on commit 14706a8

Please sign in to comment.