Skip to content
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

Disable download protection remote lookups (brave/brave-browser#4341) #2710

Merged
merged 1 commit into from
Oct 3, 2019

Conversation

fmarier
Copy link
Member

@fmarier fmarier commented Jun 15, 2019

Fixes brave/brave-browser#4341.

Submitter Checklist:

Test Plan:

To test that remote lookups are no longer done, go to https://testsafebrosing.appspot.com and verify that none of the Download Warnings files get blocked. Ideally, do this while looking at a MITM proxy to ensure that nothing is sent to sb-ssl.google.com or sb-ssl.brave.com.

To test that the "bad binary" list is still used against the download URL, I made a build which always flags download URLs as dangerous:

--- a/chrome/browser/safe_browsing/download_protection/download_url_sb_client.cc
+++ b/chrome/browser/safe_browsing/download_protection/download_url_sb_client.cc
@@ -58,7 +58,7 @@ void DownloadUrlSBClient::StartCheck() {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (!database_manager_.get() ||
       database_manager_->CheckDownloadUrl(url_chain_, this)) {
-    CheckDone(SB_THREAT_TYPE_SAFE);
+    CheckDone(SB_THREAT_TYPE_URL_BINARY_MALWARE);
   } else {
     // Add a reference to this object to prevent it from being destroyed
     // before url checking result is returned.
@@ -74,7 +74,7 @@ bool DownloadUrlSBClient::IsDangerous(SBThreatType threat_type) const {
 void DownloadUrlSBClient::OnCheckDownloadUrlResult(
     const std::vector<GURL>& url_chain,
     SBThreatType threat_type) {
-  CheckDone(threat_type);
+  CheckDone(SB_THREAT_TYPE_URL_BINARY_MALWARE);
   UMA_HISTOGRAM_TIMES("SB2.DownloadUrlCheckDuration",
                       base::TimeTicks::Now() - start_time_);
   Release();

and then verified that any download would be blocked.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

@fmarier fmarier requested a review from simonhong June 15, 2019 02:46
@fmarier fmarier self-assigned this Jun 15, 2019
@simonhong
Copy link
Member

simonhong commented Jun 16, 2019

I think this issue can be resolved by below one patch.
If we can avoid patch by our overriding technique, it is more preferred.
However, we need more patch files and additional implementation by using BraveCheckClientDownloadRequest.
WDYT @bridiver ?

diff --git a/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc b/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc
index 59a28c8c72340677aaed45e042fe8ad499fa4fed..eb78bab6c36dad96c4edbb46b8c09bce6b891e1f 100644
--- a/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc
+++ b/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc
@@ -599,6 +599,8 @@ std::string CheckClientDownloadRequest::SanitizeUrl(const GURL& url) const {

 void CheckClientDownloadRequest::SendRequest() {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
+  FinishRequest(DownloadCheckResult::UNKNOWN, REASON_PING_DISABLED);
+  return;

   if (item_->GetState() == download::DownloadItem::CANCELLED) {
     FinishRequest(DownloadCheckResult::UNKNOWN, REASON_DOWNLOAD_DESTROYED);

@bridiver
Copy link
Collaborator

I think this is better handled by blocking the request url in the network delegate which would not require any patching

@fmarier fmarier force-pushed the disable-download-protection-4341 branch from a8c896a to 1a5a75d Compare June 26, 2019 04:00
@fmarier fmarier requested a review from bridiver June 26, 2019 04:02
simonhong
simonhong previously approved these changes Jun 26, 2019
Copy link
Member

@simonhong simonhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. (but, need owner's approve)

@fmarier fmarier force-pushed the disable-download-protection-4341 branch from 1a5a75d to 893d3db Compare September 19, 2019 22:59
@fmarier fmarier force-pushed the disable-download-protection-4341 branch 5 times, most recently from 6a1aed7 to ed03033 Compare September 23, 2019 17:59
browser/net/BUILD.gn Outdated Show resolved Hide resolved
Copy link
Contributor

@iefremov iefremov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some improvements are needed

@fmarier fmarier force-pushed the disable-download-protection-4341 branch from ed03033 to 152d51c Compare October 2, 2019 00:21
@iefremov iefremov self-requested a review October 2, 2019 12:13
iefremov
iefremov previously approved these changes Oct 2, 2019
This also temporarily disables download protection remote lookups,
which fixes brave/brave-browser#4341.
@fmarier
Copy link
Member Author

fmarier commented Oct 2, 2019

Thanks for all of your feedback @iefremov . I believe I have addressed everything.

I just re-rested manually and ran all of the tests successfully. This is ready for your final review.

@fmarier fmarier merged commit db8172b into master Oct 3, 2019
@fmarier fmarier deleted the disable-download-protection-4341 branch October 3, 2019 17:25
@fmarier fmarier added this to the 0.72.x - Nightly milestone Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable safebrowsing download protection
4 participants