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

Side by Side Diff: components/security_state/core/security_state.cc

Issue 2666783006: [Merge M-56] Display "Not secure" verbose state for data: URLs (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/security_state/core/security_state.h" 5 #include "components/security_state/core/security_state.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 bool is_cryptographic_with_certificate = 140 bool is_cryptographic_with_certificate =
141 (url.SchemeIsCryptographic() && visible_security_state.certificate); 141 (url.SchemeIsCryptographic() && visible_security_state.certificate);
142 142
143 // Set the security level to DANGEROUS for major certificate errors. 143 // Set the security level to DANGEROUS for major certificate errors.
144 if (is_cryptographic_with_certificate && 144 if (is_cryptographic_with_certificate &&
145 net::IsCertStatusError(visible_security_state.cert_status) && 145 net::IsCertStatusError(visible_security_state.cert_status) &&
146 !net::IsCertStatusMinorError(visible_security_state.cert_status)) { 146 !net::IsCertStatusMinorError(visible_security_state.cert_status)) {
147 return DANGEROUS; 147 return DANGEROUS;
148 } 148 }
149 149
150 // data: URLs don't define a secure context, and are a vector for spoofing.
151 // Display a "Not secure" badge for all data URLs, regardless of whether
152 // they show a password or credit card field.
153 if (url.SchemeIs(url::kDataScheme))
154 return SecurityLevel::HTTP_SHOW_WARNING;
155
150 // Choose the appropriate security level for HTTP requests. 156 // Choose the appropriate security level for HTTP requests.
151 if (!is_cryptographic_with_certificate) { 157 if (!is_cryptographic_with_certificate) {
152 if (!is_origin_secure_callback.Run(url) && url.IsStandard()) { 158 if (!is_origin_secure_callback.Run(url) && url.IsStandard()) {
153 return GetSecurityLevelForNonSecureFieldTrial( 159 return GetSecurityLevelForNonSecureFieldTrial(
154 visible_security_state.displayed_password_field_on_http || 160 visible_security_state.displayed_password_field_on_http ||
155 visible_security_state.displayed_credit_card_field_on_http); 161 visible_security_state.displayed_credit_card_field_on_http);
156 } 162 }
157 return NONE; 163 return NONE;
158 } 164 }
159 165
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 pkp_bypassed == other.pkp_bypassed && 330 pkp_bypassed == other.pkp_bypassed &&
325 displayed_password_field_on_http == 331 displayed_password_field_on_http ==
326 other.displayed_password_field_on_http && 332 other.displayed_password_field_on_http &&
327 displayed_credit_card_field_on_http == 333 displayed_credit_card_field_on_http ==
328 other.displayed_credit_card_field_on_http && 334 other.displayed_credit_card_field_on_http &&
329 display_sha1_from_local_anchors_as_neutral == 335 display_sha1_from_local_anchors_as_neutral ==
330 other.display_sha1_from_local_anchors_as_neutral); 336 other.display_sha1_from_local_anchors_as_neutral);
331 } 337 }
332 338
333 } // namespace security_state 339 } // namespace security_state
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_browser_tests.cc ('k') | components/security_state/core/security_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698