Bug 1566523 - Remove com.apple.quarantine from gmp downloads. r=dminor

On MacOS Firefox will add the com.apple.quarantine attribute to files it
downloads. Firefox does this as a safety measure to indicate to the OS that the
file may be from an untrusted source.

While the attribute can be set prior to MacOS 10.15, the attribute is used to
enforce new features in 10.15. This leads to issues where if we do not clear the
attribute from GMPs we download, we will fail to load dynamic libs.

This patch means we will clear the quarantine from GMP downloads. These GMPs
come from a trusted source and are checksummed via hash.

Note, most of the heavy lifting for this was done in bug 1566700. We just
leverage the new API here.

Differential Revision: https://phabricator.services.mozilla.com/D39369

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bryce Van Dyk 2019-07-25 18:38:57 +00:00
Родитель ffe1230491
Коммит 6546334973
1 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -60,6 +60,20 @@ onmessage = async function(msg) {
// Ensure files are writable and executable. Otherwise, we may be
// unable to execute or uninstall them.
await OS.File.setPermissions(destPath, { unixMode: 0o700 });
if (OS.Constants.Sys.Name == "Darwin") {
// If we're on MacOS Firefox will add the quarantine xattr to files it
// downloads. In this case we want to clear that xattr so we can load
// the CDM.
try {
await OS.File.macRemoveXAttr(destPath, "com.apple.quarantine");
} catch (e) {
// Failed to remove the attribute. This could be because the profile
// exists on a file system without xattr support.
//
// Don't fail the extraction here, as in this case it's likely we
// didn't set quarantine on these files in the first place.
}
}
extractedPaths.push(destPath);
}
postMessage({