Skip to content

Commit a2dfc41

Browse files
committed
privacy: always-on network backstop that cancels Google phone-home requests (variations, safe-browsing, metrics, component-update, optimization-hints, gcm, connectivity probe, telemetry suffixes) even when tracker blocking is off — network-level guarantee behind runtime de-googling; excludes user-facing google services so sites don't break
1 parent 9e8c098 commit a2dfc41

3 files changed

Lines changed: 91 additions & 4 deletions

File tree

shell/src/blocklist.cc

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,79 @@ bool OpenNyxBlocklist::ShouldBlock(const std::string& host_in,
217217
return false;
218218
}
219219

220+
bool OpenNyxBlocklist::ShouldBlockGooglePhoneHome(const std::string& host_in) {
221+
if (host_in.empty()) {
222+
return false;
223+
}
224+
const std::string host = ToLower(host_in);
225+
226+
// Exact phone-home hostnames Chromium reaches out to for telemetry,
227+
// variations seeds, safe-browsing, component updates, optimization hints,
228+
// domain reliability, gcm/push, and the connectivity probe. These are NOT
229+
// user-facing services, so blocking them never breaks browsing. This list is
230+
// the network backstop behind the command-line switches.
231+
static const std::unordered_set<std::string> kGooglePhoneHome = {
232+
// Variations / field trials
233+
"clients4.google.com",
234+
"clientservices.googleapis.com",
235+
// Component / extension updates
236+
"update.googleapis.com",
237+
"clients2.google.com",
238+
"clients2.googleusercontent.com",
239+
// Metrics / UMA / crash
240+
"clients1.google.com",
241+
"clients3.google.com",
242+
"clients5.google.com",
243+
"clients6.google.com",
244+
"stats.g.doubleclick.net",
245+
// Safe Browsing
246+
"safebrowsing.googleapis.com",
247+
"safebrowsing.google.com",
248+
"sb-ssl.google.com",
249+
// Optimization hints / prefetch proxy
250+
"optimizationguide-pa.googleapis.com",
251+
// Domain reliability
252+
"domain-reliability.googleapis.com",
253+
// GCM / push (Chrome's background messaging)
254+
"mtalk.google.com",
255+
"gcm.googleapis.com",
256+
// Connectivity / captive-portal probe
257+
"connectivitycheck.gstatic.com",
258+
// Translate backend (the API host, not the user-facing translate.google
259+
// .com site)
260+
"translate.googleapis.com",
261+
};
262+
if (kGooglePhoneHome.find(host) != kGooglePhoneHome.end()) {
263+
return true;
264+
}
265+
266+
// Suffix families that are pure telemetry/ads infrastructure.
267+
static const char* kGoogleTelemetrySuffixes[] = {
268+
"gvt2.com", // update / experiment pings
269+
"doubleclick.net",
270+
"google-analytics.com",
271+
"googletagmanager.com",
272+
"googletagservices.com",
273+
"googlesyndication.com",
274+
"app-measurement.com",
275+
"crashlytics.com",
276+
};
277+
std::string h = host;
278+
while (!h.empty()) {
279+
for (const char* suf : kGoogleTelemetrySuffixes) {
280+
if (h == suf) {
281+
return true;
282+
}
283+
}
284+
const size_t dot = h.find('.');
285+
if (dot == std::string::npos) {
286+
break;
287+
}
288+
h = h.substr(dot + 1);
289+
}
290+
return false;
291+
}
292+
220293
void OpenNyxBlocklist::RecordBlock(const std::string& first_party_host) {
221294
total_blocked_.fetch_add(1);
222295
if (first_party_host.empty()) {

shell/src/blocklist.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ class OpenNyxBlocklist {
3737
bool ShouldBlock(const std::string& host,
3838
const std::string& first_party_host);
3939

40+
// Always-on Google phone-home guard, independent of the tracker toggle and
41+
// WITHOUT any first-party exception. This is the network-level backstop for
42+
// runtime de-googling: even if a command-line switch fails to suppress a
43+
// Google telemetry/variations/safe-browsing call, the request is cancelled
44+
// here. Returns true for hosts that are pure Google phone-home endpoints
45+
// (never user-facing services like google.com search or googlevideo).
46+
bool ShouldBlockGooglePhoneHome(const std::string& host);
47+
4048
// Total number of domains in the bundled list.
4149
size_t size() const { return domains_.size(); }
4250

shell/src/opennyx_client.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,22 @@ cef_return_value_t OpenNyxClient::OnBeforeResourceLoad(
176176
CefRefPtr<CefRequest> request,
177177
CefRefPtr<CefCallback> callback) {
178178
OpenNyxBlocklist* bl = OpenNyxBlocklist::Get();
179-
if (!bl->enabled()) {
180-
return RV_CONTINUE;
181-
}
182179
const std::string url = request->GetURL().ToString();
183180
// Never block our own scheme.
184181
if (url.compare(0, 10, "opennyx://") == 0) {
185182
return RV_CONTINUE;
186183
}
187-
// Extract host of the request and of the first-party document.
188184
const std::string req_host = HostOf(url);
185+
// Always-on Google phone-home backstop: runs even when the tracker toggle is
186+
// OFF. This is the network-level guarantee behind runtime de-googling.
187+
if (!req_host.empty() && bl->ShouldBlockGooglePhoneHome(req_host)) {
188+
bl->RecordBlock(HostOf(frame ? frame->GetURL().ToString() : std::string()));
189+
return RV_CANCEL;
190+
}
191+
if (!bl->enabled()) {
192+
return RV_CONTINUE;
193+
}
194+
// Extract host of the first-party document.
189195
std::string fp_host;
190196
if (frame) {
191197
fp_host = HostOf(frame->GetURL().ToString());

0 commit comments

Comments
 (0)