-
Notifications
You must be signed in to change notification settings - Fork 0
/
0001-safe_browsing-disable-cookie-transmission.patch
150 lines (141 loc) · 8.82 KB
/
0001-safe_browsing-disable-cookie-transmission.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
From 97a19179ac22df94a0273a1511749b6137e9bce5 Mon Sep 17 00:00:00 2001
From: Joachim Bauch <[email protected]>
Date: Wed, 22 Jul 2015 12:24:15 +0200
Subject: [PATCH] safe_browsing: disable cookie transmission
Disables sending/setting cookies for Safebrowsing requests. This
prevents the long-living tracking cookie from being set.
References: https://github.com/iridium-browser/iridium-browser/issues/37
---
.../chrome_cleaner/chrome_cleaner_fetcher_win.cc | 6 +++---
.../safe_browsing/client_side_detection_service.cc | 7 ++++++-
.../download_protection/check_client_download_request.cc | 2 +-
.../download_protection/ppapi_download_request.cc | 2 +-
chrome/browser/safe_browsing/protocol_manager.cc | 16 ++++++++++++----
components/safe_browsing/browser/threat_details_cache.cc | 2 +-
6 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc
index 4f7d2279096b..fe3ed1a2e2c2 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc
+++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc
@@ -205,9 +205,9 @@ void ChromeCleanerFetcher::OnTemporaryDirectoryCreated(bool success) {
data_use_measurement::DataUseUserData::AttachToFetcher(
url_fetcher_.get(), data_use_measurement::DataUseUserData::SAFE_BROWSING);
- url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE |
- net::LOAD_DO_NOT_SEND_COOKIES |
- net::LOAD_DO_NOT_SAVE_COOKIES);
+
+url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES);
+
url_fetcher_->SetMaxRetriesOn5xx(3);
url_fetcher_->SaveResponseToFileAtPath(temp_file_, blocking_task_runner_);
url_fetcher_->SetRequestContext(g_browser_process->system_request_context());
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc
index caa24bb5de38..734c1cf5300a 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_service.cc
@@ -345,7 +345,9 @@ void ClientSideDetectionService::StartClientReportPhishingRequest(
info->phishing_url = GURL(request->url());
client_phishing_reports_[fetcher_ptr] = std::move(info);
- fetcher_ptr->SetLoadFlags(net::LOAD_DISABLE_CACHE);
+ fetcher_ptr->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
+ net::LOAD_DO_NOT_SEND_COOKIES |
+ net::LOAD_DISABLE_CACHE);
fetcher_ptr->SetRequestContext(request_context_getter_.get());
fetcher_ptr->SetUploadData("application/octet-stream", request_data);
fetcher_ptr->Start();
@@ -426,6 +428,9 @@ void ClientSideDetectionService::StartClientReportMalwareRequest(
info->original_url = GURL(request->url());
client_malware_reports_[fetcher_ptr] = std::move(info);
+ fetcher_ptr->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
+ net::LOAD_DO_NOT_SEND_COOKIES |
+ net::LOAD_DISABLE_CACHE);
fetcher_ptr->SetLoadFlags(net::LOAD_DISABLE_CACHE);
fetcher_ptr->SetRequestContext(request_context_getter_.get());
fetcher_ptr->SetUploadData("application/octet-stream", request_data);
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 1c5ba8d985b2..55533f262280 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
@@ -971,7 +971,7 @@ void CheckClientDownloadRequest::SendRequest() {
net::URLFetcher::POST, this, traffic_annotation);
data_use_measurement::DataUseUserData::AttachToFetcher(
fetcher_.get(), data_use_measurement::DataUseUserData::SAFE_BROWSING);
- fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
+ fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES);
fetcher_->SetAutomaticallyRetryOn5xx(false); // Don't retry on error.
fetcher_->SetRequestContext(service_->request_context_getter_.get());
fetcher_->SetUploadData("application/octet-stream",
diff --git a/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc b/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc
index 5e87d3bea9fc..cb40665d2445 100644
--- a/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc
+++ b/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc
@@ -241,7 +241,7 @@ void PPAPIDownloadRequest::SendRequest() {
this, traffic_annotation);
data_use_measurement::DataUseUserData::AttachToFetcher(
fetcher_.get(), data_use_measurement::DataUseUserData::SAFE_BROWSING);
- fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
+ fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES);
fetcher_->SetAutomaticallyRetryOn5xx(false);
fetcher_->SetRequestContext(service_->request_context_getter_.get());
fetcher_->SetUploadData("application/octet-stream",
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 9ef0471453ea..e80b19a599c4 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -293,7 +293,9 @@ void SafeBrowsingProtocolManager::GetFullHash(
const std::string get_hash = FormatGetHash(prefixes);
- fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE);
+ fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE |
+ net::LOAD_DO_NOT_SAVE_COOKIES |
+ net::LOAD_DO_NOT_SEND_COOKIES);
fetcher->SetRequestContext(request_context_getter_.get());
fetcher->SetUploadData("text/plain", get_hash);
fetcher->Start();
@@ -685,7 +687,9 @@ bool SafeBrowsingProtocolManager::IssueBackupUpdateRequest(
net::URLFetcher::POST, this, traffic_annotation);
data_use_measurement::DataUseUserData::AttachToFetcher(
request_.get(), data_use_measurement::DataUseUserData::SAFE_BROWSING);
- request_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
+ request_->SetLoadFlags(net::LOAD_DISABLE_CACHE |
+ net::LOAD_DO_NOT_SAVE_COOKIES |
+ net::LOAD_DO_NOT_SEND_COOKIES);
request_->SetRequestContext(request_context_getter_.get());
request_->SetUploadData("text/plain", update_list_data_);
request_->Start();
@@ -714,7 +718,9 @@ void SafeBrowsingProtocolManager::IssueChunkRequest() {
kChunkBackupRequestTrafficAnnotation);
data_use_measurement::DataUseUserData::AttachToFetcher(
request_.get(), data_use_measurement::DataUseUserData::SAFE_BROWSING);
- request_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
+ request_->SetLoadFlags(net::LOAD_DISABLE_CACHE |
+ net::LOAD_DO_NOT_SAVE_COOKIES |
+ net::LOAD_DO_NOT_SEND_COOKIES);
request_->SetRequestContext(request_context_getter_.get());
chunk_request_start_ = base::Time::Now();
request_->Start();
@@ -768,7 +774,9 @@ void SafeBrowsingProtocolManager::OnGetChunksComplete(
kChunkBackupRequestTrafficAnnotation);
data_use_measurement::DataUseUserData::AttachToFetcher(
request_.get(), data_use_measurement::DataUseUserData::SAFE_BROWSING);
- request_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
+ request_->SetLoadFlags(net::LOAD_DISABLE_CACHE |
+ net::LOAD_DO_NOT_SAVE_COOKIES |
+ net::LOAD_DO_NOT_SEND_COOKIES);
request_->SetRequestContext(request_context_getter_.get());
request_->SetUploadData("text/plain", update_list_data_);
request_->Start();
diff --git a/components/safe_browsing/browser/threat_details_cache.cc b/components/safe_browsing/browser/threat_details_cache.cc
index 8b5ed066b609..7caef515bf6b 100644
--- a/components/safe_browsing/browser/threat_details_cache.cc
+++ b/components/safe_browsing/browser/threat_details_cache.cc
@@ -119,7 +119,7 @@ void ThreatDetailsCacheCollector::OpenEntry() {
// Only from cache, and don't save cookies.
current_fetch_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE |
net::LOAD_SKIP_CACHE_VALIDATION |
- net::LOAD_DO_NOT_SAVE_COOKIES);
+ net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES);
current_fetch_->SetAutomaticallyRetryOn5xx(false); // No retries.
current_fetch_->Start(); // OnURLFetchComplete will be called when done.
}
--
2.14.3