Skip to content

Instantly share code, notes, and snippets.

@VKen
Last active May 20, 2025 01:02
Show Gist options
  • Save VKen/3e667a2016cc8e8296bd87e28d8a8f74 to your computer and use it in GitHub Desktop.
Save VKen/3e667a2016cc8e8296bd87e28d8a8f74 to your computer and use it in GitHub Desktop.
Re-enable disabled firefox extensions addons 2025-03-15

Re-enable all firefox's disabled extensions addons 2025-03-15

RUN THIS SCRIPT AT YOUR OWN RISK

This is for addons signature expiry of firefox in 2025-03-15. Not recommended unless you understand the security risks.

If you are not running Firefox ESR with xpinstall.signatures.required set to false i.e. normal firefox, then you have some steps to follow first to tweak your firefox, your OS's methods may vary:

This script is to be run in firefox developer console.

Works for some newer version (2024+) of firefox, so you may have to tweak as needed for your firefox version e.g. ChromeUtils to Components.

  • may need to run special developer console Ctrl-Shift-J
  • may need to set devtools.chrome.enabled to true in about:config

credits goes to:

unsigned addons 24 hours validity due to automatic re-verify

Addons may be automaticallly re-verified and re-disabled due to default timer of 24 hours set in the settings.

You may want to find const XPI_SIGNATURE_CHECK_PERIOD = 24 * 60 * 60; in omni.ja's ./modules/addons/XPIProvider.jsm to edit accordingly.

You may also want to look at verifySignatures() in omni.ja's ./modules/addons/XPIPDatabase.jsm

You may need to find the files in other locations in different version of firefox.

Some users reported that in certain firefox versions, the edits to omni.ja doesn't work, as there's a precompiled version somewhere.

credits: https://www.reddit.com/r/firefox/comments/1jbhi1v/comment/mi243z7/

Disable 24hours firefox addons re-verification - Tested and Verified

credits: https://christopherstanton.net/articles/firefox_cert_25.php

reproducing the content excerpt:

  1. Remove the verification function:

Open XPIInstall.jsm (or the file you extracted) with a text editor and search for the text string verifySignedState. You should be directed to a function somewhat like the following:

async verifySignedState(addonId, addonType, addonLocation) {
  if (!shouldVerifySignedState(addonType, addonLocation)) {
    return {
      signedState: AddonManager.SIGNEDSTATE_NOT_REQUIRED,
      cert: null,
    };
  }

  let root = Ci.nsIX509CertDB.AddonsPublicRoot;
  if (
    !AppConstants.MOZ_REQUIRE_SIGNING &&
    Services.prefs.getBoolPref(PREF_XPI_SIGNATURES_DEV_ROOT, false)
  ) {
    root = Ci.nsIX509CertDB.AddonsStageRoot;
  }

  return this.verifySignedStateForRoot(addonId, root);
}

If you cannot find this function, try searching for SIGNEDSTATE as displayed above. For older Firefox versions, this function may be in a different file such as XPIProvider or AddonSettings. Keep extracting and searching until you find the right one.

Once you have found the correct function, prepend every line in the function with comments // like so, leaving the SIGNEDSTATE_NOT_REQUIRED return statement unchanged:

async verifySignedState(addonId, addonType, addonLocation) {
  //if (!shouldVerifySignedState(addonType, addonLocation)) {
    return {
      signedState: AddonManager.SIGNEDSTATE_NOT_REQUIRED,
      cert: null,
    };
  //}

  //let root = Ci.nsIX509CertDB.AddonsPublicRoot;
  //if (
  //  !AppConstants.MOZ_REQUIRE_SIGNING &&
  //  Services.prefs.getBoolPref(PREF_XPI_SIGNATURES_DEV_ROOT, false)
  //) {
  //  root = Ci.nsIX509CertDB.AddonsStageRoot;
  //}

  //return this.verifySignedStateForRoot(addonId, root);
}

The comments are basically telling the application "ignore this line", so you can can also just replace the function entirely like so. The result will be the same either way:

async verifySignedState(addonId, addonType, addonLocation) {
    return {
      signedState: AddonManager.SIGNEDSTATE_NOT_REQUIRED,
      cert: null,
    };
}

After changing the function, save the file and reinsert it into omni.ja (on your desktop). Save the archive as needed; most tools automatically save whenever you reinsert a file.

Move the modified omni.ja back into your Firefox installation directory, overwriting the file that is already there (you did back up the file first, right?).

RUN THIS SCRIPT AT YOUR OWN RISK

// Re-enable *all* extensions
// ==
// *RUN THIS SCRIPT AT YOUR OWN RISK*
//
// if you are not running Firefox ESR with `xpinstall.signatures.required` set to `false`,
// then you have some steps to follow first to tweak your firefox, your OS's methods may vary:
// - https://www.reddit.com/r/firefox/comments/1jbhi1v/comment/mhv0lst/
//
// This script is to be run in firefox developer console.
// Works for some newer version (2024+) of firefox, so you may have to tweak as needed
// for your firefox version e.g. `ChromeUtils` to `Components`.
// - may need to run special developer console `Ctrl-Shift-J`
// - may need to set `devtools.chrome.enabled` to `true` in `about:config`
// credits goes to:
// - https://www.reddit.com/r/firefox/comments/1jbhi1v/comment/mhv0lst/
// - https://news.ycombinator.com/item?id=19824410
//
// unsigned addons 24 hours validity
// ==
// Addons may be automaticallly re-verified and re-disabled due to default timer of 24 hours set in the settings.
// You may want to find `const XPI_SIGNATURE_CHECK_PERIOD = 24 * 60 * 60;` in `omni.ja`'s `./modules/addons/XPIProvider.jsm`
// to edit accordingly. You may also want to look at `verifySignatures()` in `omni.ja`'s `./modules/addons/XPIPDatabase.jsm`
// you may need to find the files in other locations in different version of firefox.
// some users reported that in certain firefox versions, the edits to omni.ja doesn't work, as there's a precompiled version somewhere.
// credits: https://www.reddit.com/r/firefox/comments/1jbhi1v/comment/mi243z7/
//
// *RUN THIS SCRIPT AT YOUR OWN RISK*
async function set_addons_as_signed() {
// original script, doesn't work in my version because object's components
// doesn't automatically get defined as an object in the current scope
//ChromeUtils.import("resource://gre/modules/addons/XPIDatabase.jsm");
//ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
// manually define the components in the current scope for components used later
const XPIDatabase = ChromeUtils.import("resource://gre/modules/addons/XPIDatabase.jsm").XPIDatabase;
const AddonManager = ChromeUtils.import("resource://gre/modules/AddonManager.jsm").AddonManager;
const AddonManagerPrivate = ChromeUtils.import("resource://gre/modules/AddonManager.jsm").AddonManagerPrivate;
let addons = await XPIDatabase.getAddonList(a => true);
for (let addon of addons) {
// The add-on might have vanished, we'll catch that on the next startup
if (addon._sourceBundle && !addon._sourceBundle.exists())
continue;
if( addon.signedState != AddonManager.SIGNEDSTATE_UNKNOWN )
continue;
addon.signedState = AddonManager.SIGNEDSTATE_NOT_REQUIRED;
AddonManagerPrivate.callAddonListeners("onPropertyChanged",
addon.wrapper,
["signedState"]);
await XPIDatabase.updateAddonDisabledState(addon);
}
XPIDatabase.saveChanges();
}
set_addons_as_signed();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment