Chromium Code Reviews| 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 #ifndef COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ | 5 #ifndef COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
| 6 #define COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ | 6 #define COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 // fields. | 103 // fields. |
| 104 bool IsCertLikelyFromMultiTenantHosting(const GURL& request_url, | 104 bool IsCertLikelyFromMultiTenantHosting(const GURL& request_url, |
| 105 const net::X509Certificate& cert); | 105 const net::X509Certificate& cert); |
| 106 | 106 |
| 107 // Returns true if the hostname in |request_url_| has the same domain | 107 // Returns true if the hostname in |request_url_| has the same domain |
| 108 // (effective TLD + 1 label) as at least one of the subject | 108 // (effective TLD + 1 label) as at least one of the subject |
| 109 // alternative names in |cert_|. | 109 // alternative names in |cert_|. |
| 110 bool IsCertLikelyFromSameDomain(const GURL& request_url, | 110 bool IsCertLikelyFromSameDomain(const GURL& request_url, |
| 111 const net::X509Certificate& cert); | 111 const net::X509Certificate& cert); |
| 112 | 112 |
| 113 // Returns true if the site's hostname differs from one of the DNS | 113 // Returns true if the site's hostname differs from one of the DNS names in the |
| 114 // names in the certificate (CN or SANs) only by the presence or | 114 // certificate (SANs) only by the presence or absence of the single-label prefix |
| 115 // absence of the single-label prefix "www". E.g.: (The first domain | 115 // "www". E.g.: (The first domain is the url's hostname and the second domain is |
| 116 // is hostname and the second domain is a DNS name in the certificate) | 116 // a DNS name in the certificate): |
| 117 // www.example.com ~ example.com -> true | 117 // www.example.com ~ example.com -> true |
| 118 // example.com ~ www.example.com -> true | 118 // example.com ~ www.example.com -> true |
| 119 // www.food.example.com ~ example.com -> false | 119 // www.food.example.com ~ example.com -> false |
| 120 // mail.example.com ~ example.com -> false | 120 // mail.example.com ~ example.com -> false |
| 121 bool IsWWWSubDomainMatch(const GURL& request_url, | |
|
estark
2017/04/03 02:01:42
Does this need to live in the public interface? Lo
elawrence
2017/04/04 15:52:28
Done.
| |
| 122 const net::X509Certificate& cert); | |
| 123 | |
| 124 // Returns true if the site's hostname differs from one of the DNS names in | |
| 125 // |dns_names| only by the presence or absence of the single-label prefix "www". | |
| 126 // The matching name from the certificate is returned in |www_match_host_name|. | |
| 121 bool GetWWWSubDomainMatch(const GURL& request_url, | 127 bool GetWWWSubDomainMatch(const GURL& request_url, |
| 122 const std::vector<std::string>& dns_names, | 128 const std::vector<std::string>& dns_names, |
| 123 std::string* www_match_host_name); | 129 std::string* www_match_host_name); |
| 124 | 130 |
| 125 // Method for recording results. ----------------------------------------------- | 131 // Method for recording results. ----------------------------------------------- |
| 126 | 132 |
| 127 void RecordUMAStatistics(bool overridable, | 133 void RecordUMAStatistics(bool overridable, |
| 128 const base::Time& current_time, | 134 const base::Time& current_time, |
| 129 const GURL& request_url, | 135 const GURL& request_url, |
| 130 int cert_error, | 136 int cert_error, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 // appspot.com. | 171 // appspot.com. |
| 166 bool AnyNamesUnderName(const std::vector<HostnameTokens>& potential_children, | 172 bool AnyNamesUnderName(const std::vector<HostnameTokens>& potential_children, |
| 167 const HostnameTokens& parent); | 173 const HostnameTokens& parent); |
| 168 | 174 |
| 169 // Exposed for teshting. | 175 // Exposed for teshting. |
| 170 size_t GetLevenshteinDistance(const std::string& str1, const std::string& str2); | 176 size_t GetLevenshteinDistance(const std::string& str1, const std::string& str2); |
| 171 | 177 |
| 172 } // namespace ssl_errors | 178 } // namespace ssl_errors |
| 173 | 179 |
| 174 #endif // COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ | 180 #endif // COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
| OLD | NEW |