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

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

Issue 1294673005: Disable Name Mismatch redirection for non-overridable SSL errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | no next file » | 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/ssl/ssl_error_handler.h" 5 #include "chrome/browser/ssl/ssl_error_handler.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ssl/ssl_blocking_page.h" 12 #include "chrome/browser/ssl/ssl_blocking_page.h"
13 #include "chrome/browser/ssl/ssl_cert_reporter.h" 13 #include "chrome/browser/ssl/ssl_cert_reporter.h"
14 #include "chrome/browser/ssl/ssl_error_classification.h" 14 #include "chrome/browser/ssl/ssl_error_classification.h"
15 #include "content/public/browser/notification_service.h" 15 #include "content/public/browser/notification_service.h"
16 #include "content/public/browser/notification_source.h" 16 #include "content/public/browser/notification_source.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "net/base/net_errors.h"
18 19
19 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 20 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
20 #include "chrome/browser/captive_portal/captive_portal_service.h" 21 #include "chrome/browser/captive_portal/captive_portal_service.h"
21 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" 22 #include "chrome/browser/captive_portal/captive_portal_service_factory.h"
22 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" 23 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h"
23 #include "chrome/browser/ssl/captive_portal_blocking_page.h" 24 #include "chrome/browser/ssl/captive_portal_blocking_page.h"
24 #endif 25 #endif
25 26
26 namespace { 27 namespace {
27 28
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 148 }
148 149
149 void SSLErrorHandler::StartHandlingError() { 150 void SSLErrorHandler::StartHandlingError() {
150 RecordUMA(HANDLE_ALL); 151 RecordUMA(HANDLE_ALL);
151 152
152 std::vector<std::string> dns_names; 153 std::vector<std::string> dns_names;
153 ssl_info_.cert->GetDNSNames(&dns_names); 154 ssl_info_.cert->GetDNSNames(&dns_names);
154 DCHECK(!dns_names.empty()); 155 DCHECK(!dns_names.empty());
155 GURL suggested_url; 156 GURL suggested_url;
156 if (IsSSLCommonNameMismatchHandlingEnabled() && 157 if (IsSSLCommonNameMismatchHandlingEnabled() &&
157 ssl_info_.cert_status == net::CERT_STATUS_COMMON_NAME_INVALID && 158 cert_error_ == net::ERR_CERT_COMMON_NAME_INVALID &&
159 SSLBlockingPage::IsOverridable(options_mask_, profile_) &&
meacer 2015/08/20 20:51:39 Can you add a unit test for this?
Bhanu Dev 2015/08/20 22:45:06 Done.
158 GetSuggestedUrl(dns_names, &suggested_url)) { 160 GetSuggestedUrl(dns_names, &suggested_url)) {
159 RecordUMA(WWW_MISMATCH_FOUND); 161 RecordUMA(WWW_MISMATCH_FOUND);
160 net::CertStatus extra_cert_errors = 162 net::CertStatus extra_cert_errors =
161 ssl_info_.cert_status ^ net::CERT_STATUS_COMMON_NAME_INVALID; 163 ssl_info_.cert_status ^ net::CERT_STATUS_COMMON_NAME_INVALID;
162 164
163 // Show the SSL intersitial if |CERT_STATUS_COMMON_NAME_INVALID| is not 165 // Show the SSL intersitial if |CERT_STATUS_COMMON_NAME_INVALID| is not
164 // the only error. Need not check for captive portal in this case. 166 // the only error. Need not check for captive portal in this case.
165 // (See the comment below). 167 // (See the comment below).
166 if (net::IsCertStatusError(extra_cert_errors) && 168 if (net::IsCertStatusError(extra_cert_errors) &&
167 !net::IsCertStatusMinorError(ssl_info_.cert_status)) { 169 !net::IsCertStatusMinorError(ssl_info_.cert_status)) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 timer_.Stop(); 327 timer_.Stop();
326 if (result == CommonNameMismatchHandler::SuggestedUrlCheckResult:: 328 if (result == CommonNameMismatchHandler::SuggestedUrlCheckResult::
327 SUGGESTED_URL_AVAILABLE) { 329 SUGGESTED_URL_AVAILABLE) {
328 RecordUMA(WWW_MISMATCH_URL_AVAILABLE); 330 RecordUMA(WWW_MISMATCH_URL_AVAILABLE);
329 NavigateToSuggestedURL(suggested_url); 331 NavigateToSuggestedURL(suggested_url);
330 } else { 332 } else {
331 RecordUMA(WWW_MISMATCH_URL_NOT_AVAILABLE); 333 RecordUMA(WWW_MISMATCH_URL_NOT_AVAILABLE);
332 ShowSSLInterstitial(); 334 ShowSSLInterstitial();
333 } 335 }
334 } 336 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698