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

Side by Side Diff: chrome/browser/ssl/ssl_error_classification.cc

Issue 549363002: Add histograms to record the severity scores for certain SSL errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and respond to comments. Created 6 years, 3 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 | tools/metrics/histograms/histograms.xml » ('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 <vector> 5 #include <vector>
6 6
7 #include "chrome/browser/ssl/ssl_error_classification.h" 7 #include "chrome/browser/ssl/ssl_error_classification.h"
8 8
9 #include "base/build_time.h" 9 #include "base/build_time.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 CAPTIVE_PORTAL_DETECTION_ENABLED_OVERRIDABLE, 58 CAPTIVE_PORTAL_DETECTION_ENABLED_OVERRIDABLE,
59 CAPTIVE_PORTAL_PROBE_COMPLETED, 59 CAPTIVE_PORTAL_PROBE_COMPLETED,
60 CAPTIVE_PORTAL_PROBE_COMPLETED_OVERRIDABLE, 60 CAPTIVE_PORTAL_PROBE_COMPLETED_OVERRIDABLE,
61 CAPTIVE_PORTAL_NO_RESPONSE, 61 CAPTIVE_PORTAL_NO_RESPONSE,
62 CAPTIVE_PORTAL_NO_RESPONSE_OVERRIDABLE, 62 CAPTIVE_PORTAL_NO_RESPONSE_OVERRIDABLE,
63 CAPTIVE_PORTAL_DETECTED, 63 CAPTIVE_PORTAL_DETECTED,
64 CAPTIVE_PORTAL_DETECTED_OVERRIDABLE, 64 CAPTIVE_PORTAL_DETECTED_OVERRIDABLE,
65 UNUSED_CAPTIVE_PORTAL_EVENT, 65 UNUSED_CAPTIVE_PORTAL_EVENT,
66 }; 66 };
67 67
68 void RecordSSLInterstitialSeverityScore(float ssl_severity_score,
69 int cert_error) {
70 if (SSLErrorInfo::NetErrorToErrorType(cert_error) ==
71 SSLErrorInfo::CERT_DATE_INVALID) {
72 UMA_HISTOGRAM_COUNTS_100("interstitial.ssl.severity_score.date_invalid",
Ryan Sleevi 2014/09/11 20:56:25 UMA_HISTOGRAM_COUNTS_100 creates 50 buckets for 1-
73 static_cast<int>(ssl_severity_score * 100));
74 }
75 if (SSLErrorInfo::NetErrorToErrorType(cert_error) ==
76 SSLErrorInfo::CERT_COMMON_NAME_INVALID) {
Ryan Sleevi 2014/09/11 20:51:07 These are mutually exclusive conditions, right? Wo
palmer 2014/09/11 20:58:30 Done.
77 UMA_HISTOGRAM_COUNTS_100(
78 "interstitial.ssl.severity_score.common_name_invalid",
79 static_cast<int>(ssl_severity_score * 100));
80 }
81 }
82
68 // Scores/weights which will be constant through all the SSL error types. 83 // Scores/weights which will be constant through all the SSL error types.
69 static const float kServerWeight = 0.5f; 84 static const float kServerWeight = 0.5f;
70 static const float kClientWeight = 0.5f; 85 static const float kClientWeight = 0.5f;
71 86
72 void RecordSSLInterstitialCause(bool overridable, SSLInterstitialCause event) { 87 void RecordSSLInterstitialCause(bool overridable, SSLInterstitialCause event) {
73 if (overridable) { 88 if (overridable) {
74 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.cause.overridable", event, 89 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.cause.overridable", event,
75 UNUSED_INTERSTITIAL_CAUSE_ENTRY); 90 UNUSED_INTERSTITIAL_CAUSE_ENTRY);
76 } else { 91 } else {
77 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.cause.nonoverridable", event, 92 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.cause.nonoverridable", event,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 215
201 // Server-side characteristics. Check whether the certificate has expired or 216 // Server-side characteristics. Check whether the certificate has expired or
202 // is not yet valid. If the certificate has expired then factor the time which 217 // is not yet valid. If the certificate has expired then factor the time which
203 // has passed since expiry. 218 // has passed since expiry.
204 if (cert_.HasExpired()) { 219 if (cert_.HasExpired()) {
205 severity_date_score += kServerWeight * kCertificateExpiredWeight * 220 severity_date_score += kServerWeight * kCertificateExpiredWeight *
206 CalculateScoreTimePassedSinceExpiry(); 221 CalculateScoreTimePassedSinceExpiry();
207 } 222 }
208 if (current_time_ < cert_.valid_start()) 223 if (current_time_ < cert_.valid_start())
209 severity_date_score += kServerWeight * kNotYetValidWeight; 224 severity_date_score += kServerWeight * kNotYetValidWeight;
210 // TODO(felt): Record the severity score in a histogram. This will be 225
211 // in the next CL - just called the function in ssl_blocking_page.cc. 226 RecordSSLInterstitialSeverityScore(severity_date_score, cert_error_);
212 } 227 }
213 228
214 void SSLErrorClassification::InvalidCommonNameSeverityScore() { 229 void SSLErrorClassification::InvalidCommonNameSeverityScore() {
215 SSLErrorInfo::ErrorType type = 230 SSLErrorInfo::ErrorType type =
216 SSLErrorInfo::NetErrorToErrorType(cert_error_); 231 SSLErrorInfo::NetErrorToErrorType(cert_error_);
217 DCHECK(type == SSLErrorInfo::CERT_COMMON_NAME_INVALID); 232 DCHECK(type == SSLErrorInfo::CERT_COMMON_NAME_INVALID);
218 float severity_name_score = 0.0f; 233 float severity_name_score = 0.0f;
219 234
220 static const float kWWWDifferenceWeight = 0.3f; 235 static const float kWWWDifferenceWeight = 0.3f;
221 static const float kNameUnderAnyNamesWeight = 0.2f; 236 static const float kNameUnderAnyNamesWeight = 0.2f;
(...skipping 17 matching lines...) Expand all
239 if (AnyNamesUnderName(dns_name_tokens, host_name_tokens)) 254 if (AnyNamesUnderName(dns_name_tokens, host_name_tokens))
240 severity_name_score += kServerWeight * kAnyNamesUnderNameWeight; 255 severity_name_score += kServerWeight * kAnyNamesUnderNameWeight;
241 if (IsCertLikelyFromMultiTenantHosting()) 256 if (IsCertLikelyFromMultiTenantHosting())
242 severity_name_score += kServerWeight * kLikelyMultiTenantHostingWeight; 257 severity_name_score += kServerWeight * kLikelyMultiTenantHostingWeight;
243 } 258 }
244 259
245 static const float kEnvironmentWeight = 0.25f; 260 static const float kEnvironmentWeight = 0.25f;
246 261
247 severity_name_score += kClientWeight * kEnvironmentWeight * 262 severity_name_score += kClientWeight * kEnvironmentWeight *
248 CalculateScoreEnvironments(); 263 CalculateScoreEnvironments();
249 // TODO(felt): Record the severity score in a histogram. Same as above 264
250 // - this will be in the next CL. So just called the function in the 265 RecordSSLInterstitialSeverityScore(severity_name_score, cert_error_);
251 // ssl_blocking_page.cc.
252 } 266 }
253 267
254 void SSLErrorClassification::RecordUMAStatistics( 268 void SSLErrorClassification::RecordUMAStatistics(
255 bool overridable) const { 269 bool overridable) const {
256 SSLErrorInfo::ErrorType type = 270 SSLErrorInfo::ErrorType type =
257 SSLErrorInfo::NetErrorToErrorType(cert_error_); 271 SSLErrorInfo::NetErrorToErrorType(cert_error_);
258 switch (type) { 272 switch (type) {
259 case SSLErrorInfo::CERT_DATE_INVALID: { 273 case SSLErrorInfo::CERT_DATE_INVALID: {
260 if (IsUserClockInThePast(base::Time::NowFromSystemTime())) 274 if (IsUserClockInThePast(base::Time::NowFromSystemTime()))
261 RecordSSLInterstitialCause(overridable, CLOCK_PAST); 275 RecordSSLInterstitialCause(overridable, CLOCK_PAST);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // sure we don't clear the captive protal flag, since the interstitial was 595 // sure we don't clear the captive protal flag, since the interstitial was
582 // potentially caused by the captive portal. 596 // potentially caused by the captive portal.
583 captive_portal_detected_ = captive_portal_detected_ || 597 captive_portal_detected_ = captive_portal_detected_ ||
584 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); 598 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL);
585 // Also keep track of non-HTTP portals and error cases. 599 // Also keep track of non-HTTP portals and error cases.
586 captive_portal_no_response_ = captive_portal_no_response_ || 600 captive_portal_no_response_ = captive_portal_no_response_ ||
587 (results->result == captive_portal::RESULT_NO_RESPONSE); 601 (results->result == captive_portal::RESULT_NO_RESPONSE);
588 } 602 }
589 #endif 603 #endif
590 } 604 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698