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

Side by Side Diff: chrome/browser/safe_browsing/client_side_detection_host.cc

Issue 2927123004: Enable client side phishing detection on https sites. (Closed)
Patch Set: address nparker's comments Created 3 years, 6 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 | chrome/browser/safe_browsing/client_side_detection_host_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/safe_browsing/client_side_detection_host.h" 5 #include "chrome/browser/safe_browsing/client_side_detection_host.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 if (csd_service_->IsPrivateIPAddress(socket_address_.host())) { 105 if (csd_service_->IsPrivateIPAddress(socket_address_.host())) {
106 DVLOG(1) << "Skipping phishing classification for URL: " << url_ 106 DVLOG(1) << "Skipping phishing classification for URL: " << url_
107 << " because of hosting on private IP: " 107 << " because of hosting on private IP: "
108 << socket_address_.host(); 108 << socket_address_.host();
109 DontClassifyForPhishing(NO_CLASSIFY_PRIVATE_IP); 109 DontClassifyForPhishing(NO_CLASSIFY_PRIVATE_IP);
110 DontClassifyForMalware(NO_CLASSIFY_PRIVATE_IP); 110 DontClassifyForMalware(NO_CLASSIFY_PRIVATE_IP);
111 } 111 }
112 112
113 // For phishing we only classify HTTP pages. 113 // For phishing we only classify HTTP or HTTPS pages.
114 if (!url_.SchemeIs(url::kHttpScheme)) { 114 if (!url_.SchemeIsHTTPOrHTTPS()) {
115 DVLOG(1) << "Skipping phishing classification for URL: " << url_ 115 DVLOG(1) << "Skipping phishing classification for URL: " << url_
116 << " because it is not HTTP: " 116 << " because it is not HTTP or HTTPS: "
117 << socket_address_.host(); 117 << socket_address_.host();
118 DontClassifyForPhishing(NO_CLASSIFY_NOT_HTTP_URL); 118 DontClassifyForPhishing(NO_CLASSIFY_SCHEME_NOT_SUPPORTED);
119 } 119 }
120 120
121 // Don't run any classifier if the tab is incognito. 121 // Don't run any classifier if the tab is incognito.
122 if (web_contents_->GetBrowserContext()->IsOffTheRecord()) { 122 if (web_contents_->GetBrowserContext()->IsOffTheRecord()) {
123 DVLOG(1) << "Skipping phishing and malware classification for URL: " 123 DVLOG(1) << "Skipping phishing and malware classification for URL: "
124 << url_ << " because we're browsing incognito."; 124 << url_ << " because we're browsing incognito.";
125 DontClassifyForPhishing(NO_CLASSIFY_OFF_THE_RECORD); 125 DontClassifyForPhishing(NO_CLASSIFY_OFF_THE_RECORD);
126 DontClassifyForMalware(NO_CLASSIFY_OFF_THE_RECORD); 126 DontClassifyForMalware(NO_CLASSIFY_OFF_THE_RECORD);
127 } 127 }
128 128
(...skipping 20 matching lines...) Expand all
149 csd_service_ = NULL; 149 csd_service_ = NULL;
150 host_ = NULL; 150 host_ = NULL;
151 } 151 }
152 152
153 private: 153 private:
154 friend class base::RefCountedThreadSafe< 154 friend class base::RefCountedThreadSafe<
155 ClientSideDetectionHost::ShouldClassifyUrlRequest>; 155 ClientSideDetectionHost::ShouldClassifyUrlRequest>;
156 156
157 // Enum used to keep stats about why the pre-classification check failed. 157 // Enum used to keep stats about why the pre-classification check failed.
158 enum PreClassificationCheckFailures { 158 enum PreClassificationCheckFailures {
159 OBSOLETE_NO_CLASSIFY_PROXY_FETCH, 159 OBSOLETE_NO_CLASSIFY_PROXY_FETCH = 0,
160 NO_CLASSIFY_PRIVATE_IP, 160 NO_CLASSIFY_PRIVATE_IP = 1,
161 NO_CLASSIFY_OFF_THE_RECORD, 161 NO_CLASSIFY_OFF_THE_RECORD = 2,
162 NO_CLASSIFY_MATCH_CSD_WHITELIST, 162 NO_CLASSIFY_MATCH_CSD_WHITELIST = 3,
163 NO_CLASSIFY_TOO_MANY_REPORTS, 163 NO_CLASSIFY_TOO_MANY_REPORTS = 4,
164 NO_CLASSIFY_UNSUPPORTED_MIME_TYPE, 164 NO_CLASSIFY_UNSUPPORTED_MIME_TYPE = 5,
165 NO_CLASSIFY_NO_DATABASE_MANAGER, 165 NO_CLASSIFY_NO_DATABASE_MANAGER = 6,
166 NO_CLASSIFY_KILLSWITCH, 166 NO_CLASSIFY_KILLSWITCH = 7,
167 NO_CLASSIFY_CANCEL, 167 NO_CLASSIFY_CANCEL = 8,
168 NO_CLASSIFY_RESULT_FROM_CACHE, 168 NO_CLASSIFY_RESULT_FROM_CACHE = 9,
169 NO_CLASSIFY_NOT_HTTP_URL, 169 DEPRECATED_NO_CLASSIFY_NOT_HTTP_URL = 10,
170 NO_CLASSIFY_SCHEME_NOT_SUPPORTED = 11,
170 171
171 NO_CLASSIFY_MAX // Always add new values before this one. 172 NO_CLASSIFY_MAX // Always add new values before this one.
172 }; 173 };
173 174
174 // The destructor can be called either from the UI or the IO thread. 175 // The destructor can be called either from the UI or the IO thread.
175 virtual ~ShouldClassifyUrlRequest() { } 176 virtual ~ShouldClassifyUrlRequest() { }
176 177
177 bool ShouldClassifyForPhishing() const { 178 bool ShouldClassifyForPhishing() const {
178 DCHECK_CURRENTLY_ON(BrowserThread::UI); 179 DCHECK_CURRENTLY_ON(BrowserThread::UI);
179 return !start_phishing_classification_cb_.is_null(); 180 return !start_phishing_classification_cb_.is_null();
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 ui_manager_->RemoveObserver(this); 722 ui_manager_->RemoveObserver(this);
722 723
723 ui_manager_ = ui_manager; 724 ui_manager_ = ui_manager;
724 if (ui_manager) 725 if (ui_manager)
725 ui_manager_->AddObserver(this); 726 ui_manager_->AddObserver(this);
726 727
727 database_manager_ = database_manager; 728 database_manager_ = database_manager;
728 } 729 }
729 730
730 } // namespace safe_browsing 731 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/client_side_detection_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698