Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc

Issue 1843663002: Add another feature flag which allows SuspiciousModule reports to be sent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/incident_reporting/module_load_analyzer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/feature_list.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/process/process_info.h" 17 #include "base/process/process_info.h"
17 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
18 #include "base/stl_util.h" 19 #include "base/stl_util.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
20 #include "base/thread_task_runner_handle.h" 21 #include "base/thread_task_runner_handle.h"
21 #include "base/threading/sequenced_worker_pool.h" 22 #include "base/threading/sequenced_worker_pool.h"
22 #include "build/build_config.h" 23 #include "build/build_config.h"
(...skipping 12 matching lines...) Expand all
35 #include "chrome/common/safe_browsing/csd.pb.h" 36 #include "chrome/common/safe_browsing/csd.pb.h"
36 #include "components/prefs/pref_service.h" 37 #include "components/prefs/pref_service.h"
37 #include "components/safe_browsing_db/database_manager.h" 38 #include "components/safe_browsing_db/database_manager.h"
38 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h " 39 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h "
39 #include "content/public/browser/browser_thread.h" 40 #include "content/public/browser/browser_thread.h"
40 #include "content/public/browser/notification_service.h" 41 #include "content/public/browser/notification_service.h"
41 #include "net/url_request/url_request_context_getter.h" 42 #include "net/url_request/url_request_context_getter.h"
42 43
43 namespace safe_browsing { 44 namespace safe_browsing {
44 45
46 // Enables reporting of suspicious modules loaded in the process. If this
47 // feature is disabled, incidents get pruned instead of reported.
48 extern const base::Feature kIncidentReportingSuspiciousModuleReporting{
grt (UTC plus 2) 2016/03/29 20:37:58 nit: omit extern? nit: space before { (unless git
49 "IncidentReportingSuspiciousModuleReporting",
50 base::FEATURE_DISABLED_BY_DEFAULT};
51
45 namespace { 52 namespace {
46 53
47 // The action taken for an incident; used for user metrics (see 54 // The action taken for an incident; used for user metrics (see
48 // LogIncidentDataType). 55 // LogIncidentDataType).
49 enum IncidentDisposition { 56 enum IncidentDisposition {
50 RECEIVED, 57 RECEIVED,
51 DROPPED, 58 DROPPED,
52 ACCEPTED, 59 ACCEPTED,
53 PRUNED, 60 PRUNED,
54 DISCARDED, 61 DISCARDED,
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 state.digest)) { 973 state.digest)) {
967 LogIncidentDataType(PRUNED, *incident); 974 LogIncidentDataType(PRUNED, *incident);
968 } else if (!ProfileCanAcceptIncident(profile_and_context.first, 975 } else if (!ProfileCanAcceptIncident(profile_and_context.first,
969 *incident)) { 976 *incident)) {
970 LogIncidentDataType(DROPPED, *incident); 977 LogIncidentDataType(DROPPED, *incident);
971 } else if (!has_download) { 978 } else if (!has_download) {
972 LogIncidentDataType(NO_DOWNLOAD, *incident); 979 LogIncidentDataType(NO_DOWNLOAD, *incident);
973 // Drop the incident and mark for future pruning since no executable 980 // Drop the incident and mark for future pruning since no executable
974 // download was found. 981 // download was found.
975 transaction.MarkAsReported(state.type, state.key, state.digest); 982 transaction.MarkAsReported(state.type, state.key, state.digest);
983 } else if (incident->GetType() == IncidentType::SUSPICIOUS_MODULE &&
grt (UTC plus 2) 2016/03/29 20:37:58 can't say i like having the service know intimate
proberge 2016/03/29 20:47:10 Yeah, it's not great. We'll get rid of this piece
984 !base::FeatureList::IsEnabled(
985 kIncidentReportingSuspiciousModuleReporting)) {
986 LogIncidentDataType(PRUNED, *incident);
987 // Drop the incident and mark for future pruning.
988 transaction.MarkAsReported(state.type, state.key, state.digest);
976 } else { 989 } else {
977 LogIncidentDataType(ACCEPTED, *incident); 990 LogIncidentDataType(ACCEPTED, *incident);
978 // Ownership of the payload is passed to the report. 991 // Ownership of the payload is passed to the report.
979 ClientIncidentReport_IncidentData* data = 992 ClientIncidentReport_IncidentData* data =
980 incident->TakePayload().release(); 993 incident->TakePayload().release();
981 DCHECK(data->has_incident_time_msec()); 994 DCHECK(data->has_incident_time_msec());
982 report->mutable_incident()->AddAllocated(data); 995 report->mutable_incident()->AddAllocated(data);
983 data = nullptr; 996 data = nullptr;
984 states.push_back(state); 997 states.push_back(state);
985 } 998 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 if (!profile->IsOffTheRecord()) 1129 if (!profile->IsOffTheRecord())
1117 OnProfileDestroyed(profile); 1130 OnProfileDestroyed(profile);
1118 break; 1131 break;
1119 } 1132 }
1120 default: 1133 default:
1121 break; 1134 break;
1122 } 1135 }
1123 } 1136 }
1124 1137
1125 } // namespace safe_browsing 1138 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/incident_reporting/module_load_analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698