Bug 1230857 - Make GMPInstallManager enforce sensible permissions on GMP files at install time. r=spohl draft
authorChris Pearce <cpearce@mozilla.com>
Thu, 14 Jan 2016 15:16:06 +1300
changeset 321623 94f267c7b4707a2190270cd7313118d008dc05da
parent 321622 c7a274b5751043bb3c6303290a41b8420f9d7141
child 512939 74a820e5a36935f86f7729a05c2740c34337183c
push id9420
push usercpearce@mozilla.com
push dateThu, 14 Jan 2016 03:48:57 +0000
reviewersspohl
bugs1230857
milestone46.0a1
Bug 1230857 - Make GMPInstallManager enforce sensible permissions on GMP files at install time. r=spohl This ensures that GMP packages with bad permissions will still be usable. For example, a GMP without execute/read permissions in its zip won't work without this.
toolkit/modules/GMPInstallManager.jsm
--- a/toolkit/modules/GMPInstallManager.jsm
+++ b/toolkit/modules/GMPInstallManager.jsm
@@ -416,16 +416,19 @@ GMPExtractor.prototype = {
         outFile.appendRelativePath(entry);
 
         // Make sure the directory hierarchy exists
         if(!outFile.parent.exists()) {
           outFile.parent.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0755", 8));
         }
         zipReader.extract(entry, outFile);
         extractedPaths.push(outFile.path);
+        // Ensure files are writable and executable. Otherwise we may be unable to
+        // execute or uninstall them.
+        outFile.permissions |= parseInt("0700", 8);
         log.info(entry + " was successfully extracted to: " +
             outFile.path);
       });
       zipReader.close();
       if (!GMPInstallManager.overrideLeaveDownloadedZip) {
         zipFile.remove(false);
       }