Bug 1288840 - Use the private phishing site list in official build. r=francois
authorHenry Chang <hchang@mozilla.com>
Mon, 25 Jul 2016 09:18:25 +0800
changeset 332495 aaf6318572b6a00e6d484bfabe2f4912588d46bf
parent 332494 d7ec7fcb18432a580e7a1581115d9e532e894a29
child 332496 3f66f98ebf11bfd0933a145cad375c7a0785a46b
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrancois
bugs1288840
milestone50.0a1
Bug 1288840 - Use the private phishing site list in official build. r=francois MozReview-Commit-ID: 3SYoP2z1jWb
modules/libpref/init/all.js
toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
toolkit/components/url-classifier/tests/unit/test_threat_type_conversion.js
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5054,17 +5054,24 @@ pref("dom.voicemail.enabled", false);
 // parameter omitted.
 pref("dom.voicemail.defaultServiceId", 0);
 
 // Enable mapped array buffer by default.
 pref("dom.mapped_arraybuffer.enabled", true);
 
 // The tables used for Safebrowsing phishing and malware checks.
 pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,test-malware-simple,test-unwanted-simple");
+
+#ifdef MOZILLA_OFFICIAL
+// In the official build, we are allowed to use google's private
+// phishing list "goog-phish-shavar". See Bug 1288840.
 pref("urlclassifier.phishTable", "goog-phish-shavar,test-phish-simple");
+#else
+pref("urlclassifier.phishTable", "googpub-phish-shavar,test-phish-simple");
+#endif
 
 // Tables for application reputation.
 pref("urlclassifier.downloadBlockTable", "goog-badbinurl-shavar");
 
 #ifdef XP_WIN
  // Only download the whitelist on Windows, since the whitelist is
  // only useful for suppressing remote lookups for signed binaries which we can
  // only verify on Windows (Bug 974579). Other platforms always do remote lookups.
@@ -5108,24 +5115,24 @@ pref("browser.safebrowsing.downloads.rem
 pref("browser.safebrowsing.downloads.remote.block_dangerous",            true);
 pref("browser.safebrowsing.downloads.remote.block_dangerous_host",       true);
 pref("browser.safebrowsing.downloads.remote.block_potentially_unwanted", true);
 pref("browser.safebrowsing.downloads.remote.block_uncommon",             true);
 pref("browser.safebrowsing.debug", false);
 
 // The protocol version we communicate with google server.
 pref("browser.safebrowsing.provider.google.pver", "2.2");
-pref("browser.safebrowsing.provider.google.lists", "goog-badbinurl-shavar,goog-downloadwhite-digest256,goog-phish-shavar,goog-malware-shavar,goog-unwanted-shavar");
+pref("browser.safebrowsing.provider.google.lists", "goog-badbinurl-shavar,goog-downloadwhite-digest256,goog-phish-shavar,googpub-phish-shavar,goog-malware-shavar,goog-unwanted-shavar");
 pref("browser.safebrowsing.provider.google.updateURL", "https://safebrowsing.google.com/safebrowsing/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2&key=%GOOGLE_API_KEY%");
 pref("browser.safebrowsing.provider.google.gethashURL", "https://safebrowsing.google.com/safebrowsing/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2");
 pref("browser.safebrowsing.provider.google.reportURL", "https://safebrowsing.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site=");
 
 // Prefs for v4.
 pref("browser.safebrowsing.provider.google4.pver", "4");
-pref("browser.safebrowsing.provider.google4.lists", "goog-phish-proto,goog-malware-proto,goog-unwanted-proto");
+pref("browser.safebrowsing.provider.google4.lists", "goog-phish-proto,googpub-phish-proto,goog-malware-proto,goog-unwanted-proto");
 pref("browser.safebrowsing.provider.google4.updateURL", "https://safebrowsing.googleapis.com/v4/threatListUpdates:fetch?$req=%REQUEST_BASE64%&$ct=application/x-protobuf&key=%GOOGLE_API_KEY%");
 pref("browser.safebrowsing.provider.google4.gethashURL", "https://safebrowsing.googleapis.com/v4/fullHashes:find?$req=%REQUEST_BASE64%&$ct=application/x-protobuf&key=%GOOGLE_API_KEY%");
 pref("browser.safebrowsing.provider.google4.reportURL", "https://safebrowsing.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site=");
 
 pref("browser.safebrowsing.reportPhishMistakeURL", "https://%LOCALE%.phish-error.mozilla.com/?hl=%LOCALE%&url=");
 pref("browser.safebrowsing.reportPhishURL", "https://%LOCALE%.phish-report.mozilla.com/?hl=%LOCALE%&url=");
 pref("browser.safebrowsing.reportMalwareMistakeURL", "https://%LOCALE%.malware-error.mozilla.com/?hl=%LOCALE%&url=");
 
--- a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
@@ -195,23 +195,27 @@ nsUrlClassifierUtils::GetKeyForURI(nsIUR
 
   _retval.Append(temp);
 
   return NS_OK;
 }
 
 // We use "goog-*-proto" as the list name for v4, where "proto" indicates
 // it's updated (as well as hash completion) via protobuf.
+//
+// In the mozilla official build, we are allowed to use the
+// private phishing list (goog-phish-proto). See Bug 1288840.
 static const struct {
   const char* mListName;
   uint32_t mThreatType;
 } THREAT_TYPE_CONV_TABLE[] = {
   { "goog-malware-proto",  MALWARE_THREAT},            // 1
-  { "goog-phish-proto",    SOCIAL_ENGINEERING_PUBLIC}, // 2
+  { "googpub-phish-proto", SOCIAL_ENGINEERING_PUBLIC}, // 2
   { "goog-unwanted-proto", UNWANTED_SOFTWARE},         // 3
+  { "goog-phish-proto", SOCIAL_ENGINEERING},           // 5
 };
 
 NS_IMETHODIMP
 nsUrlClassifierUtils::ConvertThreatTypeToListName(uint32_t aThreatType,
                                                   nsACString& aListName)
 {
   for (uint32_t i = 0; i < ArrayLength(THREAT_TYPE_CONV_TABLE); i++) {
     if (aThreatType == THREAT_TYPE_CONV_TABLE[i].mThreatType) {
--- a/toolkit/components/url-classifier/tests/unit/test_threat_type_conversion.js
+++ b/toolkit/components/url-classifier/tests/unit/test_threat_type_conversion.js
@@ -1,32 +1,34 @@
 function run_test() {
   let urlUtils = Cc["@mozilla.org/url-classifier/utils;1"]
                    .getService(Ci.nsIUrlClassifierUtils);
 
   // Test list name to threat type conversion.
 
   equal(urlUtils.convertListNameToThreatType("goog-malware-proto"), 1);
-  equal(urlUtils.convertListNameToThreatType("goog-phish-proto"), 2);
+  equal(urlUtils.convertListNameToThreatType("googpub-phish-proto"), 2);
   equal(urlUtils.convertListNameToThreatType("goog-unwanted-proto"), 3);
+  equal(urlUtils.convertListNameToThreatType("goog-phish-proto"), 5);
 
   try {
     urlUtils.convertListNameToThreatType("bad-list-name");
     ok(false, "Bad list name should lead to exception.");
   } catch (e) {}
 
   try {
     urlUtils.convertListNameToThreatType("bad-list-name");
     ok(false, "Bad list name should lead to exception.");
   } catch (e) {}
 
   // Test threat type to list name conversion.
   equal(urlUtils.convertThreatTypeToListName(1), "goog-malware-proto");
-  equal(urlUtils.convertThreatTypeToListName(2), "goog-phish-proto");
+  equal(urlUtils.convertThreatTypeToListName(2), "googpub-phish-proto");
   equal(urlUtils.convertThreatTypeToListName(3), "goog-unwanted-proto");
+  equal(urlUtils.convertThreatTypeToListName(5), "goog-phish-proto");
 
   try {
     urlUtils.convertThreatTypeToListName(0);
     ok(false, "Bad threat type should lead to exception.");
   } catch (e) {}
 
   try {
     urlUtils.convertThreatTypeToListName(100);