Firefox(41.0b1)的最新更新积极阻止未验证扩展的安装,即HTTPS Everywhere和Privacy Badger。
我如何能够强制安装这些扩展?about:config
我是否可以临时切换内部设置?
Mozilla的突出这种变化火狐在这里,并指出其先前的努力是在网罗恶意扩展低效。
Firefox(41.0b1)的最新更新积极阻止未验证扩展的安装,即HTTPS Everywhere和Privacy Badger。
我如何能够强制安装这些扩展?about:config
我是否可以临时切换内部设置?
Mozilla的突出这种变化火狐在这里,并指出其先前的努力是在网罗恶意扩展低效。
Answers:
是的,其中有一个设置About:config
,名称为xpinstall.signatures.required
。双击首选项名称,以便将其值设置为false。现在,您可以在Firefox中安装未签名的扩展。无需重新启动浏览器。
在Firefox 48及更高版本上,此方法无效。相反,您应该在Firefox目录中创建两个配置文件。
在记事本中创建config.js文件(确保文件扩展名为.js而不是.txt):
//
try {
Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {})
.eval("SIGNED_TYPES.clear()");
}
catch(ex) {}
将config.js移至Firefox安装目录:
Windows: C:\ Program Files \ Mozilla Firefox
(或 C:\ Program Files(x86)\ Mozilla Firefox)
Linux:
/ usr / lib64 / firefox- <版本>
(或/ usr / lib / firefox- <版本>)
Mac: /Applications/Firefox.app
在记事本中创建config-prefs.js:
pref("general.config.obscure_value", 0);
pref("general.config.filename", "config.js");
将config-prefs.js移至Firefox defaults \ pref目录。
(例如C:\ Program Files \ Mozilla Firefox \ defaults \ pref)
重新启动Firefox。
将未签名的XPI拖动到Firefox窗口中,或在Firefox附加组件的设置中使用“从文件安装附加组件”选项。
源自此来源:https : //forum.mozilla-russia.org/viewtopic.php?id=70326
显然,在Firefox 60及更高版本上,上述概述xpinstall.signatures.required
的config.js技巧均无效(Mozilla,请耐心等待!)。
上面提到的俄语论坛显然也提到了针对这些版本的Firefox的解决方案。因此,将其放入config.js中,然后将其保存到C:\ Program Files \ Mozilla Firefox
//
try {(code => {
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
var jsval, evl = true, re = e => Cu.reportError(e), imp = name => {try {
return Cu.import(`resource://gre/modules/addons/${name}.jsm`, {});
} catch(ex) {}}
if ((jsval = imp("AddonSettings"))) {
jsval.AddonSettings = {ADDON_SIGNING: false, REQUIRE_SIGNING: false, ALLOW_LEGACY_EXTENSIONS: true};
try {evl = jsval.eval("this") === jsval;} catch(ex) {evl = false;}
}
var jsvals = ["XPIProvider", "XPIInstall"].map(imp).filter(i => i);
jsvals[0].AddonSettings && lockPref("extensions.allow-non-mpc-extensions", true);
jsvals[0].signaturesNotRequired = true;
if (evl) return jsvals.forEach(jsval => {try {jsval.eval(code);} catch(ex) {re(ex);}});
var sl = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
Cu.importGlobalProperties(["URL", "Blob"]); var url = URL.createObjectURL(new Blob([(code)]));
jsvals.forEach(jsval => {try {sl.loadSubScript(url, jsval);} catch(ex) {re(ex);}});
})(String.raw`((vzss, pckg) => {
var trueDesc = {enumerable: true, value: true};
typeof Extension == "function" && Object.defineProperty(Extension.prototype, "experimentsAllowed", trueDesc);
"AddonInternal" in this && Object.defineProperty(AddonInternal.prototype, "providesUpdatesSecurely", trueDesc);
this.isDisabledLegacy = () => false;
if ("XPIDatabase" in this) this.XPIDatabase.isDisabledLegacy = () => false;
try {SIGNED_TYPES.clear();} catch(ex) {};
if (!vzss && !pckg) return;
var re = /\x06\x03U\x04\x03..(\{[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-\._]+)0\x82\x02"0\r\x06\t/i;
var getUUID = () => {
var gen = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
return (getUUID = () => gen.generateUUID().toString())();
}
var getIdFromString = str => {
var match = str && str.match(re);
return match ? match[1] : getUUID();
}
var getState = arg => ({
signedState: AddonManager.SIGNEDSTATE_NOT_REQUIRED,
cert: typeof arg == "object" ? arg : {commonName: arg}
});
var checkAddon = addon => {
if (addon.id || (
"_installLocation" in addon
? addon._installLocation.name == KEY_APP_TEMPORARY
: addon.location.isTemporary
))
return getState(null);
}
var getRoot = () =>
!AppConstants.MOZ_REQUIRE_SIGNING && Services.prefs.getBoolPref(PREF_XPI_SIGNATURES_DEV_ROOT, false)
? Ci.nsIX509CertDB.AddonsStageRoot : Ci.nsIX509CertDB.AddonsPublicRoot;
if (vzss) {
var getURI = file => {
var jsval = Cu.import("resource://gre/modules/addons/XPIProvider.jsm", {});
return (getURI = file => jsval.getURIForResourceInFile(file, "META-INF/mozilla.rsa"))(file);
}
var getIdFromFile = file => {
var str, is = {close() {}}, sis = {close() {}};
try {
is = Services.io.newChannelFromURIWithLoadInfo(getURI(file), null).open();
sis = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(Ci.nsIScriptableInputStream);
sis.init(is);
str = sis.readBytes(sis.available());
} catch(ex) {}
sis.close(); is.close();
return getIdFromString(str);
}
this.verifyZipSignedState = function verifyZipSignedState(aFile, aAddon) {
var res = checkAddon(aAddon);
return res ? Promise.resolve(res) : new Promise(resolve => {
var callback = {openSignedAppFileFinished(rv, zipReader, cert) {
zipReader && zipReader.close();
resolve(getState(cert || getIdFromFile(aFile)));
}};
gCertDB.openSignedAppFileAsync(getRoot(), aFile, callback.wrappedJSObject = callback);
});
}
}
if (pckg) Package.prototype.verifySignedState = function verifySignedState(addon) {
var res = checkAddon(addon);
return res ? Promise.resolve(res) : new Promise(resolve =>
this.verifySignedStateForRoot(addon, getRoot()).then(({cert}) => {
if (cert)
resolve(getState(cert));
else
this.readBinary("META-INF", "mozilla.rsa").then(
buffer => resolve(getState(
getIdFromString(String.fromCharCode(...new Uint8Array(buffer)))
)),
() => resolve(getState(getUUID()))
);
}, Cu.reportError)
);
}
})(
"verifyZipSignedState" in this, typeof Package == "function"
);`)} catch(err) {
err.message != "Components is not defined" && Components.utils.reportError(err);
}
然后,您必须将其添加到保存到C:\ Program Files \ Mozilla Firefox \ defaults \ pref的config-prefs.js文件中
pref("general.config.obscure_value", 0);
pref("general.config.filename", "config.js");
pref("general.config.sandbox_enabled", false);
经过测试,可以在FF 66.0.3上运行。不幸的是,它不会神奇地带回您的插件和主题,但至少可以重新启用重新安装它们的选项。无论如何,Mozilla都比它提供的要好,因为尽管他们的论坛上充斥着对此问题的抱怨,但他们似乎并不特别在意。
xpinstall.signatures.required
似乎仍然可以在这里运行。