Commit 837b32b0 authored by jialiul's avatar jialiul Committed by Commit Bot

Enable client side phishing detection on https sites.

(Client side malware detection is already enabled on https).

BUG=730895

Review-Url: https://codereview.chromium.org/2927123004
Cr-Commit-Position: refs/heads/master@{#478810}
parent 05d349a9
...@@ -110,12 +110,12 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest ...@@ -110,12 +110,12 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest
DontClassifyForMalware(NO_CLASSIFY_PRIVATE_IP); DontClassifyForMalware(NO_CLASSIFY_PRIVATE_IP);
} }
// For phishing we only classify HTTP pages. // For phishing we only classify HTTP or HTTPS pages.
if (!url_.SchemeIs(url::kHttpScheme)) { if (!url_.SchemeIsHTTPOrHTTPS()) {
DVLOG(1) << "Skipping phishing classification for URL: " << url_ DVLOG(1) << "Skipping phishing classification for URL: " << url_
<< " because it is not HTTP: " << " because it is not HTTP or HTTPS: "
<< socket_address_.host(); << socket_address_.host();
DontClassifyForPhishing(NO_CLASSIFY_NOT_HTTP_URL); DontClassifyForPhishing(NO_CLASSIFY_SCHEME_NOT_SUPPORTED);
} }
// Don't run any classifier if the tab is incognito. // Don't run any classifier if the tab is incognito.
...@@ -156,17 +156,18 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest ...@@ -156,17 +156,18 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest
// Enum used to keep stats about why the pre-classification check failed. // Enum used to keep stats about why the pre-classification check failed.
enum PreClassificationCheckFailures { enum PreClassificationCheckFailures {
OBSOLETE_NO_CLASSIFY_PROXY_FETCH, OBSOLETE_NO_CLASSIFY_PROXY_FETCH = 0,
NO_CLASSIFY_PRIVATE_IP, NO_CLASSIFY_PRIVATE_IP = 1,
NO_CLASSIFY_OFF_THE_RECORD, NO_CLASSIFY_OFF_THE_RECORD = 2,
NO_CLASSIFY_MATCH_CSD_WHITELIST, NO_CLASSIFY_MATCH_CSD_WHITELIST = 3,
NO_CLASSIFY_TOO_MANY_REPORTS, NO_CLASSIFY_TOO_MANY_REPORTS = 4,
NO_CLASSIFY_UNSUPPORTED_MIME_TYPE, NO_CLASSIFY_UNSUPPORTED_MIME_TYPE = 5,
NO_CLASSIFY_NO_DATABASE_MANAGER, NO_CLASSIFY_NO_DATABASE_MANAGER = 6,
NO_CLASSIFY_KILLSWITCH, NO_CLASSIFY_KILLSWITCH = 7,
NO_CLASSIFY_CANCEL, NO_CLASSIFY_CANCEL = 8,
NO_CLASSIFY_RESULT_FROM_CACHE, NO_CLASSIFY_RESULT_FROM_CACHE = 9,
NO_CLASSIFY_NOT_HTTP_URL, DEPRECATED_NO_CLASSIFY_NOT_HTTP_URL = 10,
NO_CLASSIFY_SCHEME_NOT_SUPPORTED = 11,
NO_CLASSIFY_MAX // Always add new values before this one. NO_CLASSIFY_MAX // Always add new values before this one.
}; };
......
...@@ -1172,6 +1172,18 @@ TEST_F(ClientSideDetectionHostTest, TestPreClassificationCheckHttpsUrl) { ...@@ -1172,6 +1172,18 @@ TEST_F(ClientSideDetectionHostTest, TestPreClassificationCheckHttpsUrl) {
NavigateAndCommit(url); NavigateAndCommit(url);
WaitAndCheckPreClassificationChecks(); WaitAndCheckPreClassificationChecks();
ExpectStartPhishingDetection(&url);
ExpectShouldClassifyForMalwareResult(true);
}
TEST_F(ClientSideDetectionHostTest,
TestPreClassificationCheckNoneHttpOrHttpsUrl) {
GURL url("file://host.com/");
ExpectPreClassificationChecks(url, &kFalse, &kFalse, &kFalse, &kFalse,
&kFalse, &kFalse, &kFalse, &kFalse);
NavigateAndCommit(url);
WaitAndCheckPreClassificationChecks();
ExpectStartPhishingDetection(NULL); ExpectStartPhishingDetection(NULL);
ExpectShouldClassifyForMalwareResult(true); ExpectShouldClassifyForMalwareResult(true);
} }
......
...@@ -31827,7 +31827,8 @@ from previous Chrome versions. ...@@ -31827,7 +31827,8 @@ from previous Chrome versions.
<int value="7" label="KILLSWITCH"/> <int value="7" label="KILLSWITCH"/>
<int value="8" label="CANCEL"/> <int value="8" label="CANCEL"/>
<int value="9" label="RESULT_FROM_CACHE"/> <int value="9" label="RESULT_FROM_CACHE"/>
<int value="10" label="NOT_HTTP_URL"/> <int value="10" label="DEPRECATED: NOT_HTTP_URL"/>
<int value="11" label="SCHEME_NOT_SUPPORTED"/>
</enum> </enum>
<enum name="SBClientDownloadCheckDownloadStats" type="int"> <enum name="SBClientDownloadCheckDownloadStats" type="int">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment