Skip to content

Commit

Permalink
Filter personal data out of download protection pings (fixes brave/br…
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarier committed Oct 2, 2020
1 parent 7326cd6 commit 0793300
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
@@ -0,0 +1,29 @@
/* Copyright (c) 2020 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/. */

#include "components/safe_browsing/core/proto/csd.pb.h"

#define BRAVE_SEND_REQUEST_FILTER BraveFilterRequest(request.get());

namespace safe_browsing {

void BraveFilterRequest(ClientDownloadRequest* request) {
request->set_url(""); // URL must be present or we get a 400.
request->clear_file_basename();
request->clear_locale();
request->clear_resources(); // Contains URLs and referrers
request->clear_referrer_chain();

// Filter binaries within archives.
for (int i=0; i < request->archived_binary_size(); i++) {
ClientDownloadRequest_ArchivedBinary* archived_binary =
request->mutable_archived_binary(i);
archived_binary->clear_file_basename();
}
}

} // namespace safe_browsing

#include "../../../../../../chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc" // NOLINT
@@ -0,0 +1,12 @@
diff --git a/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc b/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc
index 4f7fd86c5e6edd387254d0eab6aa399db5e42105..1edf51b8e80c967e275e327d8143973ec4881871 100644
--- a/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc
+++ b/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc
@@ -554,6 +554,7 @@ void CheckClientDownloadRequestBase::SendRequest() {
request->set_archive_directory_count(directory_count_);
request->set_request_ap_verdicts(is_under_advanced_protection_);

+ BRAVE_SEND_REQUEST_FILTER
if (!request->SerializeToString(&client_download_request_data_)) {
FinishRequest(DownloadCheckResult::UNKNOWN, REASON_INVALID_REQUEST_PROTO);
return;

0 comments on commit 0793300

Please sign in to comment.