Bug 1444487 Add preference for langpack signing. r=kmag a=jcristau
authorAndrew Swan <aswan@mozilla.com>
Fri, 09 Mar 2018 11:31:39 -0800
changeset 462612 aa5a03376bd2d4490557fefdd3d3792a9e0f2899
parent 462611 61018626779e19ac66142c9eecad035f309ece00
child 462613 9a8d842f8ebe1a7250ab03356fd578850687777e
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag, jcristau
bugs1444487
milestone60.0
Bug 1444487 Add preference for langpack signing. r=kmag a=jcristau MozReview-Commit-ID: FEPa2wlLBST
modules/libpref/init/all.js
toolkit/mozapps/extensions/internal/AddonSettings.jsm
toolkit/mozapps/extensions/internal/XPIInstall.jsm
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/langpack_signed.xpi
toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/langpack_unsigned.xpi
toolkit/mozapps/extensions/test/xpcshell/test_signed_langpack.js
toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5095,16 +5095,17 @@ pref("html5.flushtimer.subsequentdelay",
 pref("browser.history.maxStateObjectSize", 655360);
 
 pref("browser.meta_refresh_when_inactive.disabled", false);
 
 // XPInstall prefs
 pref("xpinstall.whitelist.required", true);
 // Only Firefox requires add-on signatures
 pref("xpinstall.signatures.required", false);
+pref("extensions.langpacks.signatures.required", false);
 pref("extensions.minCompatiblePlatformVersion", "2.0");
 pref("extensions.webExtensionsMinPlatformVersion", "42.0a1");
 pref("extensions.legacy.enabled", true);
 pref("extensions.allow-non-mpc-extensions", true);
 
 // Other webextensions prefs
 pref("extensions.webextensions.keepStorageOnUninstall", false);
 pref("extensions.webextensions.keepUuidOnUninstall", false);
--- a/toolkit/mozapps/extensions/internal/AddonSettings.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonSettings.jsm
@@ -5,16 +5,17 @@
 "use strict";
 
 var EXPORTED_SYMBOLS = [ "AddonSettings" ];
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
 const PREF_SIGNATURES_REQUIRED = "xpinstall.signatures.required";
+const PREF_LANGPACK_SIGNATURES = "extensions.langpacks.signatures.required";
 const PREF_ALLOW_LEGACY = "extensions.legacy.enabled";
 
 var AddonSettings = {};
 
 // Make a non-changable property that can't be manipulated from other
 // code in the app.
 function makeConstant(name, value) {
   Object.defineProperty(AddonSettings, name, {
@@ -29,14 +30,17 @@ makeConstant("ADDON_SIGNING", AppConstan
 
 if (AppConstants.MOZ_REQUIRE_SIGNING && !Cu.isInAutomation) {
   makeConstant("REQUIRE_SIGNING", true);
 } else {
   XPCOMUtils.defineLazyPreferenceGetter(AddonSettings, "REQUIRE_SIGNING",
                                         PREF_SIGNATURES_REQUIRED, false);
 }
 
+XPCOMUtils.defineLazyPreferenceGetter(AddonSettings, "LANGPACKS_REQUIRE_SIGNING",
+                                      PREF_LANGPACK_SIGNATURES, false);
+
 if (AppConstants.MOZ_ALLOW_LEGACY_EXTENSIONS || Cu.isInAutomation) {
   XPCOMUtils.defineLazyPreferenceGetter(AddonSettings, "ALLOW_LEGACY_EXTENSIONS",
                                         PREF_ALLOW_LEGACY, true);
 } else {
   makeConstant("ALLOW_LEGACY_EXTENSIONS", false);
 }
--- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm
@@ -55,31 +55,33 @@ XPCOMUtils.defineLazyServiceGetter(this,
                                    Ci.nsIRDFService);
 
 
 ChromeUtils.defineModuleGetter(this, "XPIInternal",
                                "resource://gre/modules/addons/XPIProvider.jsm");
 ChromeUtils.defineModuleGetter(this, "XPIProvider",
                                "resource://gre/modules/addons/XPIProvider.jsm");
 
-/* globals AddonInternal, BOOTSTRAP_REASONS, KEY_APP_SYSTEM_ADDONS, KEY_APP_SYSTEM_DEFAULTS, KEY_APP_TEMPORARY, TEMPORARY_ADDON_SUFFIX, TOOLKIT_ID, XPIDatabase, XPIStates, getExternalType, isTheme, isUsableAddon, isWebExtension, recordAddonTelemetry */
+/* globals AddonInternal, BOOTSTRAP_REASONS, KEY_APP_SYSTEM_ADDONS, KEY_APP_SYSTEM_DEFAULTS, KEY_APP_TEMPORARY, TEMPORARY_ADDON_SUFFIX, SIGNED_TYPES, TOOLKIT_ID, XPIDatabase, XPIStates, getExternalType, isTheme, isUsableAddon, isWebExtension, mustSign, recordAddonTelemetry */
 const XPI_INTERNAL_SYMBOLS = [
   "AddonInternal",
   "BOOTSTRAP_REASONS",
   "KEY_APP_SYSTEM_ADDONS",
   "KEY_APP_SYSTEM_DEFAULTS",
   "KEY_APP_TEMPORARY",
+  "SIGNED_TYPES",
   "TEMPORARY_ADDON_SUFFIX",
   "TOOLKIT_ID",
   "XPIDatabase",
   "XPIStates",
   "getExternalType",
   "isTheme",
   "isUsableAddon",
   "isWebExtension",
+  "mustSign",
   "recordAddonTelemetry",
 ];
 
 for (let name of XPI_INTERNAL_SYMBOLS) {
   XPCOMUtils.defineLazyGetter(this, name, () => XPIInternal[name]);
 }
 
 /**
@@ -151,40 +153,23 @@ const COMPATIBLE_BY_DEFAULT_TYPES = {
 const RESTARTLESS_TYPES = new Set([
   "apiextension",
   "dictionary",
   "experiment",
   "webextension",
   "webextension-theme",
 ]);
 
-const SIGNED_TYPES = new Set([
-  "apiextension",
-  "extension",
-  "experiment",
-  "webextension",
-  "webextension-theme",
-]);
-
-
 // This is a random number array that can be used as "salt" when generating
 // an automatic ID based on the directory path of an add-on. It will prevent
 // someone from creating an ID for a permanent add-on that could be replaced
 // by a temporary add-on (because that would be confusing, I guess).
 const TEMP_INSTALL_ID_GEN_SESSION =
   new Uint8Array(Float64Array.of(Math.random()).buffer);
 
-// Whether add-on signing is required.
-function mustSign(aType) {
-  if (!SIGNED_TYPES.has(aType))
-    return false;
-
-  return AddonSettings.REQUIRE_SIGNING;
-}
-
 const MSG_JAR_FLUSH = "AddonJarFlush";
 const MSG_MESSAGE_MANAGER_CACHES_FLUSH = "AddonMessageManagerCachesFlush";
 
 
 /**
  * Valid IDs fit this pattern.
  */
 var gIDTest = /^(\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\}|[a-z0-9-\._]*\@[a-z0-9-\._]+)$/i;
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -75,16 +75,17 @@ const PREF_EM_STARTUP_SCAN_SCOPES     = 
 const PREF_EM_SHOW_MISMATCH_UI        = "extensions.showMismatchUI";
 const PREF_XPI_ENABLED                = "xpinstall.enabled";
 const PREF_XPI_WHITELIST_REQUIRED     = "xpinstall.whitelist.required";
 const PREF_XPI_DIRECT_WHITELISTED     = "xpinstall.whitelist.directRequest";
 const PREF_XPI_FILE_WHITELISTED       = "xpinstall.whitelist.fileRequest";
 // xpinstall.signatures.required only supported in dev builds
 const PREF_XPI_SIGNATURES_REQUIRED    = "xpinstall.signatures.required";
 const PREF_XPI_SIGNATURES_DEV_ROOT    = "xpinstall.signatures.dev-root";
+const PREF_LANGPACK_SIGNATURES        = "extensions.langpacks.signatures.required";
 const PREF_XPI_PERMISSIONS_BRANCH     = "xpinstall.";
 const PREF_INSTALL_REQUIRESECUREORIGIN = "extensions.install.requireSecureOrigin";
 const PREF_INSTALL_DISTRO_ADDONS      = "extensions.installDistroAddons";
 const PREF_BRANCH_INSTALLED_ADDON     = "extensions.installedDistroAddon.";
 const PREF_DISTRO_ADDONS_PERMS        = "extensions.distroAddons.promptForPermissions";
 const PREF_SYSTEM_ADDON_SET           = "extensions.systemAddonSet";
 const PREF_SYSTEM_ADDON_UPDATE_URL    = "extensions.systemAddon.update.url";
 const PREF_ALLOW_LEGACY               = "extensions.legacy.enabled";
@@ -213,16 +214,17 @@ const CHROME_TYPES = new Set([
   "experiment",
 ]);
 
 const SIGNED_TYPES = new Set([
   "apiextension",
   "extension",
   "experiment",
   "webextension",
+  "webextension-langpack",
   "webextension-theme",
 ]);
 
 const LEGACY_TYPES = new Set([
   "apiextension",
   "extension",
   "theme",
 ]);
@@ -235,16 +237,20 @@ const ALL_EXTERNAL_TYPES = new Set([
   "theme",
 ]);
 
 // Whether add-on signing is required.
 function mustSign(aType) {
   if (!SIGNED_TYPES.has(aType))
     return false;
 
+  if (aType == "webextension-langpack") {
+    return AddonSettings.LANGPACKS_REQUIRE_SIGNING;
+  }
+
   return AddonSettings.REQUIRE_SIGNING;
 }
 
 // Keep track of where we are in startup for telemetry
 // event happened during XPIDatabase.startup()
 const XPI_STARTING = "XPIStarting";
 // event happened after startup() but before the final-ui-startup event
 const XPI_BEFORE_UI_STARTUP = "BeforeFinalUIStartup";
@@ -2164,16 +2170,17 @@ var XPIProvider = {
                                                                   null);
       this.minCompatiblePlatformVersion = Services.prefs.getStringPref(PREF_EM_MIN_COMPAT_PLATFORM_VERSION,
                                                                        null);
 
       Services.prefs.addObserver(PREF_EM_MIN_COMPAT_APP_VERSION, this);
       Services.prefs.addObserver(PREF_EM_MIN_COMPAT_PLATFORM_VERSION, this);
       if (!AppConstants.MOZ_REQUIRE_SIGNING || Cu.isInAutomation)
         Services.prefs.addObserver(PREF_XPI_SIGNATURES_REQUIRED, this);
+      Services.prefs.addObserver(PREF_LANGPACK_SIGNATURES, this);
       Services.prefs.addObserver(PREF_ALLOW_LEGACY, this);
       Services.prefs.addObserver(PREF_ALLOW_NON_MPC, this);
       Services.obs.addObserver(this, NOTIFICATION_FLUSH_PERMISSIONS);
       Services.obs.addObserver(this, NOTIFICATION_TOOLBOX_CONNECTION_CHANGE);
 
 
       let flushCaches = this.checkForChanges(aAppChanged, aOldAppVersion,
                                              aOldPlatformVersion);
@@ -4024,16 +4031,17 @@ var XPIProvider = {
         this.updateAddonAppDisabledStates();
         break;
       case PREF_EM_MIN_COMPAT_PLATFORM_VERSION:
         this.minCompatiblePlatformVersion = Services.prefs.getStringPref(PREF_EM_MIN_COMPAT_PLATFORM_VERSION,
                                                                          null);
         this.updateAddonAppDisabledStates();
         break;
       case PREF_XPI_SIGNATURES_REQUIRED:
+      case PREF_LANGPACK_SIGNATURES:
       case PREF_ALLOW_LEGACY:
       case PREF_ALLOW_NON_MPC:
         this.updateAddonAppDisabledStates();
         break;
       }
     }
   },
 
@@ -6978,23 +6986,25 @@ class WinRegInstallLocation extends Dire
 }
 
 var XPIInternal = {
   AddonInternal,
   BOOTSTRAP_REASONS,
   KEY_APP_SYSTEM_ADDONS,
   KEY_APP_SYSTEM_DEFAULTS,
   KEY_APP_TEMPORARY,
+  SIGNED_TYPES,
   TEMPORARY_ADDON_SUFFIX,
   TOOLKIT_ID,
   XPIStates,
   getExternalType,
   isTheme,
   isUsableAddon,
   isWebExtension,
+  mustSign,
   recordAddonTelemetry,
 
   get XPIDatabase() { return gGlobalScope.XPIDatabase; },
 };
 
 var addonTypes = [
   new AddonManagerPrivate.AddonType("extension", URI_EXTENSION_STRINGS,
                                     "type.extension.name",
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f60d00348eb41058cc3e49680029083954ba05e9
GIT binary patch
literal 4452
zc$|$`cQhRA(qBY$izur`^tNlYB}zgB(TNgPC%Q%S-bq4MwCKH;MRdU`307|*ItkID
zMOiiYlJA^*@44@J-*fIf=lSFJoS8W@&&>Ss8!c75ThssmfDkZ8=%6M(!|;Ta3;^(_
z0092Hsw?Qqft58B1raWO_D)U~5I1*=sb{{@N&d^(!=&u&Wb!8<4&(<+0{C^m{&PXq
zd63oco1qzg8>Tm?BHc!-*E^5H1$3hBuoZsH`<9gK{+N*aolog$reF5ydE36({>GK`
z&EoXc)%D)!{zYKWG!`uw(jZ0(spntfyACG=;q==gu=oZ>XjXHm9HDF{zNnVgD^b>8
zX#C7kDmh$%&=LU2Trw~+<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1f33fa3975ac3b7f5f8a6f59
GIT binary patch
literal 413
zc$^FHW@Zs#U|`^2*jt+E!&kaC=`E1=laYaemqCUhH!&|WEw#8rFRM5|FEoUcfq5z4
z;;3anTw1}+z{v6ys1B?>H^9;Fuz|oH<&W&Ap9^uh`_0)Apjao6d$%|F=*g&U&W&32
z$NS84yQ-ox)5_A){lAwxd2lz&IVMlge>7!cOX)S9S#8{t46ata+W1W(<IAcON4Hph
zj(^cSv;0Z$)~T%XKg}>p@?(0wCQx8<mh7^?(h|{BzMHD@&m2nmYtCjT+n9Zc{rV+)
zO>5VleWIJ+Ts@lh^3a?8#*(rNj`Qpl-+1F=@R4+*C>L9vWd{XbcON$nUOm5H_1@*l
z4)s^F`5Cj>H=YgDso3*#rQx<I<xh8MPiE&iB`v=5=+7&6B2Atgjs7|LhrzDiZ|TQ&
zL~waK)(3bqGRZOH3N;A^5CAe6mNbG`Xko|-2}88-3-D%TgJ@%92nNz7ApHyg6&jfk
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_langpack.js
@@ -0,0 +1,56 @@
+
+const PREF_SIGNATURES_GENERAL = "xpinstall.signatures.required";
+const PREF_SIGNATURES_LANGPACKS = "extensions.langpacks.signatures.required";
+
+// Try to install the given XPI file, and assert that the install
+// succeeds.  Uninstalls before returning.
+async function installShouldSucceed(file) {
+  let install = await promiseInstallFile(file);
+  Assert.equal(install.state, AddonManager.STATE_INSTALLED);
+  Assert.notEqual(install.addon, null);
+  install.addon.uninstall();
+}
+
+// Try to install the given XPI file, assert that the install fails
+// due to lack of signing.
+async function installShouldFail(file) {
+  let install;
+  try {
+    install = await AddonManager.getInstallForFile(file);
+  } catch (err) {}
+  Assert.equal(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
+  Assert.equal(install.error, AddonManager.ERROR_SIGNEDSTATE_REQUIRED);
+  Assert.equal(install.addon, null);
+}
+
+// Test that the preference controlling langpack signing works properly
+// (and that the general preference for addon signing does not affect
+// language packs).
+add_task(async function() {
+  AddonTestUtils.useRealCertChecks = true;
+
+  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
+  await promiseStartupManager();
+
+  Services.prefs.setBoolPref(PREF_SIGNATURES_GENERAL, true);
+  Services.prefs.setBoolPref(PREF_SIGNATURES_LANGPACKS, true);
+
+  // The signed langpack should always install.
+  let signedXPI = do_get_file("data/signing_checks/langpack_signed.xpi");
+  await installShouldSucceed(signedXPI);
+
+  // With signatures required, unsigned langpack should not install.
+  let unsignedXPI = do_get_file("data/signing_checks/langpack_unsigned.xpi");
+  await installShouldFail(unsignedXPI);
+
+  // Even with the general xpi signing pref off, an unsigned langapck
+  // should not install.
+  Services.prefs.setBoolPref(PREF_SIGNATURES_GENERAL, false);
+  await installShouldFail(unsignedXPI);
+
+  // But with the langpack signing pref off, unsigned langpack should isntall.
+  Services.prefs.setBoolPref(PREF_SIGNATURES_LANGPACKS, false);
+  await installShouldSucceed(unsignedXPI);
+
+  await promiseShutdownManager();
+});
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
@@ -313,16 +313,18 @@ skip-if = require_signing || !allow_lega
 run-if = addon_signing
 [test_signed_inject.js]
 run-if = addon_signing
 # Bug 1394122
 skip-if = true
 [test_signed_install.js]
 run-if = addon_signing
 run-sequentially = Uses hardcoded ports in xpi files.
+[test_signed_langpack.js]
+run-if = addon_signing
 [test_signed_long.js]
 run-if = addon_signing
 [test_startup.js]
 # Bug 676992: test consistently fails on Android
 fail-if = os == "android"
 [test_syncGUID.js]
 [test_strictcompatibility.js]
 [test_targetPlatforms.js]