Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter personal data out of download protection pings (fixes brave/br…
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...rc/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
12 changes: 12 additions & 0 deletions
12
...ome-browser-safe_browsing-download_protection-check_client_download_request_base.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |