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

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

Issue 1223233002: Common Name Mismatch Handler For WWW Subdomain Mismatch case (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving comments 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 | « chrome/browser/ssl/ssl_browser_tests.cc ('k') | chrome/browser/ssl/ssl_error_classification.cc » ('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 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ 5 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_
6 #define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ 6 #define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Returns true if the Windows platform is likely to not have SHA-256 support. 43 // Returns true if the Windows platform is likely to not have SHA-256 support.
44 // On other platforms, returns false always. 44 // On other platforms, returns false always.
45 static bool MaybeWindowsLacksSHA256Support(); 45 static bool MaybeWindowsLacksSHA256Support();
46 46
47 // Returns true if any one of the following conditions hold: 47 // Returns true if any one of the following conditions hold:
48 // 1.|hostname| is an IP Address in an IANA-reserved range. 48 // 1.|hostname| is an IP Address in an IANA-reserved range.
49 // 2.|hostname| is a not-yet-assigned by ICANN gTLD. 49 // 2.|hostname| is a not-yet-assigned by ICANN gTLD.
50 // 3.|hostname| is a dotless domain. 50 // 3.|hostname| is a dotless domain.
51 static bool IsHostnameNonUniqueOrDotless(const std::string& hostname); 51 static bool IsHostnameNonUniqueOrDotless(const std::string& hostname);
52 52
53 // Returns true if the site's hostname differs from one of the DNS
54 // names in the certificate (CN or SANs) only by the presence or
55 // absence of the single-label prefix "www". E.g.: (The first domain
56 // is hostname and the second domain is a DNS name in the certificate)
57 //
58 // www.example.com ~ example.com -> true
59 // example.com ~ www.example.com -> true
60 // www.food.example.com ~ example.com -> false
61 // mail.example.com ~ example.com -> false
62 static bool GetWWWSubDomainMatch(const std::string& host_name,
63 const std::vector<std::string>& dns_names,
64 std::string* www_match_host_name);
65
53 // A function which calculates the severity score when the ssl error is 66 // A function which calculates the severity score when the ssl error is
54 // |CERT_DATE_INVALID|. The calculated score is between 0.0 and 1.0, higher 67 // |CERT_DATE_INVALID|. The calculated score is between 0.0 and 1.0, higher
55 // being more severe, indicating how severe the certificate's 68 // being more severe, indicating how severe the certificate's
56 // date invalid error is. 69 // date invalid error is.
57 void InvalidDateSeverityScore(); 70 void InvalidDateSeverityScore();
58 71
59 // A function which calculates the severity score when the ssl error is 72 // A function which calculates the severity score when the ssl error is
60 // |CERT_COMMON_NAME_INVALID|. The calculated score is between 0.0 and 1.0, 73 // |CERT_COMMON_NAME_INVALID|. The calculated score is between 0.0 and 1.0,
61 // higher being more severe, indicating how severe the certificate's common 74 // higher being more severe, indicating how severe the certificate's common
62 // name invalid error is. 75 // name invalid error is.
(...skipping 13 matching lines...) Expand all
76 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest, TestDateInvalidScore); 89 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest, TestDateInvalidScore);
77 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest, TestNameMismatch); 90 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest, TestNameMismatch);
78 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest, 91 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest,
79 TestHostNameHasKnownTLD); 92 TestHostNameHasKnownTLD);
80 93
81 typedef std::vector<std::string> Tokens; 94 typedef std::vector<std::string> Tokens;
82 95
83 // Returns true if the hostname has a known Top Level Domain. 96 // Returns true if the hostname has a known Top Level Domain.
84 static bool IsHostNameKnownTLD(const std::string& host_name); 97 static bool IsHostNameKnownTLD(const std::string& host_name);
85 98
86 // Returns true if the site's hostname differs from one of the DNS 99 // Returns true if GetWWWSubDomainMatch finds a www mismatch.
87 // names in the certificate (CN or SANs) only by the presence or
88 // absence of the single-label prefix "www". E.g.:
89 //
90 // www.example.com ~ example.com -> true
91 // example.com ~ www.example.com -> true
92 // www.food.example.com ~ example.com -> false
93 // mail.example.com ~ example.com -> false
94 bool IsWWWSubDomainMatch() const; 100 bool IsWWWSubDomainMatch() const;
95 101
96 // Returns true if |child| is a subdomain of any of the |potential_parents|. 102 // Returns true if |child| is a subdomain of any of the |potential_parents|.
97 bool NameUnderAnyNames(const Tokens& child, 103 bool NameUnderAnyNames(const Tokens& child,
98 const std::vector<Tokens>& potential_parents) const; 104 const std::vector<Tokens>& potential_parents) const;
99 105
100 // Returns true if any of the |potential_children| is a subdomain of the 106 // Returns true if any of the |potential_children| is a subdomain of the
101 // |parent|. The inverse case should be treated carefully as this is most 107 // |parent|. The inverse case should be treated carefully as this is most
102 // likely a MITM attack. We don't want foo.appspot.com to be able to MITM for 108 // likely a MITM attack. We don't want foo.appspot.com to be able to MITM for
103 // appspot.com. 109 // appspot.com.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 bool captive_portal_probe_completed_; 166 bool captive_portal_probe_completed_;
161 // Did the captive portal probe receive an error or get a non-HTTP response? 167 // Did the captive portal probe receive an error or get a non-HTTP response?
162 bool captive_portal_no_response_; 168 bool captive_portal_no_response_;
163 // Was a captive portal detected? 169 // Was a captive portal detected?
164 bool captive_portal_detected_; 170 bool captive_portal_detected_;
165 171
166 content::NotificationRegistrar registrar_; 172 content::NotificationRegistrar registrar_;
167 }; 173 };
168 174
169 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ 175 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_browser_tests.cc ('k') | chrome/browser/ssl/ssl_error_classification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698