| OLD | NEW |
| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 bool is_cryptographic_with_certificate = | 117 bool is_cryptographic_with_certificate = |
| 118 (url.SchemeIsCryptographic() && visible_security_state.certificate); | 118 (url.SchemeIsCryptographic() && visible_security_state.certificate); |
| 119 | 119 |
| 120 // Set the security level to DANGEROUS for major certificate errors. | 120 // Set the security level to DANGEROUS for major certificate errors. |
| 121 if (is_cryptographic_with_certificate && | 121 if (is_cryptographic_with_certificate && |
| 122 net::IsCertStatusError(visible_security_state.cert_status) && | 122 net::IsCertStatusError(visible_security_state.cert_status) && |
| 123 !net::IsCertStatusMinorError(visible_security_state.cert_status)) { | 123 !net::IsCertStatusMinorError(visible_security_state.cert_status)) { |
| 124 return DANGEROUS; | 124 return DANGEROUS; |
| 125 } | 125 } |
| 126 | 126 |
| 127 // data: URLs don't define a secure context, and are a vector for spoofing. |
| 128 // Display a "Not secure" badge for all data URLs, regardless of whether |
| 129 // they show a password or credit card field. |
| 130 if (url.SchemeIs(url::kDataScheme)) |
| 131 return SecurityLevel::HTTP_SHOW_WARNING; |
| 132 |
| 127 // Choose the appropriate security level for HTTP requests. | 133 // Choose the appropriate security level for HTTP requests. |
| 128 if (!is_cryptographic_with_certificate) { | 134 if (!is_cryptographic_with_certificate) { |
| 129 if (!is_origin_secure_callback.Run(url) && url.IsStandard()) { | 135 if (!is_origin_secure_callback.Run(url) && url.IsStandard()) { |
| 130 return GetSecurityLevelForNonSecureFieldTrial( | 136 return GetSecurityLevelForNonSecureFieldTrial( |
| 131 visible_security_state.displayed_password_field_on_http || | 137 visible_security_state.displayed_password_field_on_http || |
| 132 visible_security_state.displayed_credit_card_field_on_http); | 138 visible_security_state.displayed_credit_card_field_on_http); |
| 133 } | 139 } |
| 134 return NONE; | 140 return NONE; |
| 135 } | 141 } |
| 136 | 142 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 other.displayed_content_with_cert_errors && | 309 other.displayed_content_with_cert_errors && |
| 304 ran_content_with_cert_errors == other.ran_content_with_cert_errors && | 310 ran_content_with_cert_errors == other.ran_content_with_cert_errors && |
| 305 pkp_bypassed == other.pkp_bypassed && | 311 pkp_bypassed == other.pkp_bypassed && |
| 306 displayed_password_field_on_http == | 312 displayed_password_field_on_http == |
| 307 other.displayed_password_field_on_http && | 313 other.displayed_password_field_on_http && |
| 308 displayed_credit_card_field_on_http == | 314 displayed_credit_card_field_on_http == |
| 309 other.displayed_credit_card_field_on_http); | 315 other.displayed_credit_card_field_on_http); |
| 310 } | 316 } |
| 311 | 317 |
| 312 } // namespace security_state | 318 } // namespace security_state |
| OLD | NEW |