How to programmatically activate extensions with no ID?

User Help for Mozilla Firefox
New Member
Posts: 1
Joined: November 29th, 2022, 10:15 am

Post Posted November 29th, 2022, 10:26 am

I'm trying to get extension IDs from the manifest.json file shipped with respective extension XPI using a bash script. I use the extracted ID data to rename XPIs and to copy them to folder .mozilla/firefox/<profile_name>/extensions. However, some of these XPIs have no ID, as specified here, which means that Firefox won't recognise (automatically activate) them when launched.

I know that the ID field is not mandatory under manifest v2, and Firefox generates a unique GUID for each XPI with no ID when one's downloaded directly from the Addons Store or installed manually.

For testing, I created a new profile, installed the downloaded XPI manually and checked the created GUID - it matches the one installed on a different profile. So, I assume the GUID generation algorithm is stably based on a certain parameter of the XPI in question, e.g. file's hash value or size, I don't know.

  • That said, can I generate GUIDs for non-IDed extensions programmatically with tools like e.g. uuidgen (Linux)? Is it a viable option at all?
  • If not, what's the recommended way of installing such XPIs with a bash script (without user interaction and manual install)?

Thank you!



User avatar
Posts: 126253
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Post Posted November 29th, 2022, 12:42 pm

Moving to Firefox Support.


User avatar
Posts: 53957
Joined: July 18th, 2005, 3:25 am

Post Posted November 29th, 2022, 4:00 pm

Those extensions may still have an ID stored in mozilla.rsa in the META-INF folder, so maybe check that file.

Posts: 5647
Joined: February 3rd, 2009, 6:29 pm

Post Posted November 29th, 2022, 4:45 pm

I parsed uBlock Origin extension id using certutil on Windows.

uBlock Origin extension id:

certutil.exe -dump mozilla.rsa

Extract extension id from mozilla.rsa (see Linux command)


User avatar
Posts: 21412
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Post Posted November 30th, 2022, 10:29 am

Oh, so it's the "CN=" that you need to look for?

Perhaps naming convention is a free-for-all?

Likewise, multiple CN records are in the .rsa file.
Perhaps it is the final one?
(I have no clue about such things.)
Code: Select all
C:\>certutil.exe -dump mozilla-noscript.rsa | grep CN= | tail -1

C:\>certutil.exe -dump mozilla.ublock.rsa | grep CN= | tail -1
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript

Posts: 5647
Joined: February 3rd, 2009, 6:29 pm

Post Posted December 1st, 2022, 7:22 am

The doc says the subject common name (CN) must match the extension id.

More info

Code: Select all
certutil.exe -dump mozilla.rsa | for /f "skip=2 delims==, tokens=2" %a in ('find "Subject: CN="') do @echo extension id: %a

Return to Firefox Support

Who is online

Users browsing this forum: redwolfe_98 and 6 guests