Skip to content

Instantly share code, notes, and snippets.

@TheBrokenRail
Last active April 30, 2024 00:23
Show Gist options
  • Star 36 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save TheBrokenRail/c43bf0f07f4860adac2631a1bd9e4136 to your computer and use it in GitHub Desktop.
Save TheBrokenRail/c43bf0f07f4860adac2631a1bd9e4136 to your computer and use it in GitHub Desktop.
Jailbreak Firefox!

Jailbreak-Firefox

This script allows you to install unsigned extensions (ones that aren't approved by Mozilla) on normal Firefox builds and the official Snap! That's right, no "Firefox Developer Edition" nonsense required!

⚠️ Disclaimer ⚠️

This script is not well tested, like at all. This script might break things, possibly important things. You should probably take a backup of your Firefox profile before using it. You have been warned.

Dependencies

sudo apt install -y curl unzip zip
# Only needed when jailbreaking the Snap
sudo apt install -y squashfs-tools

Instructions

  1. Close Firefox.
  2. Run the script!
    # Jailbreak System Firefox
    curl -L 'https://gist.github.com/TheBrokenRail/c43bf0f07f4860adac2631a1bd9e4136/raw/jailbreak-firefox-system.sh' | sh
    # Jailbreak Firefox Snap
    curl -L 'https://gist.github.com/TheBrokenRail/c43bf0f07f4860adac2631a1bd9e4136/raw/jailbreak-firefox-snap.sh' | sh
  3. Open Firefox.
  4. Navigate to about:config.
  5. Set xpinstall.signatures.required to false.
  6. Navigate to about:support.
  7. Click Clear startup cache... then Restart.
  8. Done!

Limitations

  • This script must be rerun every time Firefox updates.
  • A Firefox update may break this completely without warning.

FAQ

What are unsigned extensions?

Unsigned extensions are extensions that haven't been approved by Mozilla. Only allowing signed extensions means that Mozilla has total control over what extensions can be installed on Firefox.

What was your motivation for this?

A significant amount of spite that Mozilla was trying to control what I run on my own web browser.

Why did you name this "Jailbreak-Firefox"?

Just like jailbreaking on iOS allows you to escape Apple's walled-garden, this allows you to escape Mozilla's walled-garden.

#!/bin/sh
set -e
## Prepare
echo '**** Preparing... ****'
# Get Revision Of Firefox Snap
REV="$(snap list | grep firefox | awk '{print $3}')"
# Get Snap File
FILE="/var/lib/snapd/snaps/firefox_${REV}.snap"
# Unmount Snap
sudo systemctl stop "snap-firefox-${REV}.mount"
sudo /usr/lib/snapd/snap-discard-ns firefox
# Create Workdir
rm -rf /tmp/jailbreak-firefox-snap-workdir
mkdir /tmp/jailbreak-firefox-snap-workdir
cd /tmp/jailbreak-firefox-snap-workdir
## Modify
echo '**** Modifying... ****'
# Extract Snap
sudo chmod o+r "${FILE}"
unsquashfs -d snap "${FILE}"
# Extract omni.ja
mkdir omni
unzip -q snap/usr/lib/firefox/omni.ja -d omni || : # Ignore Errors
# Patch AppConstants.jsm
sed -i 's/MOZ_REQUIRE_SIGNING:.*/MOZ_REQUIRE_SIGNING: false, _old_require_signing:/' omni/modules/AppConstants.sys.mjs
# Repackage omni.ja
rm -f snap/usr/lib/firefox/omni.ja
cd omni
zip -0DXqr ../snap/usr/lib/firefox/omni.ja . # Source: https://stackoverflow.com/a/68379534
cd ../
# Rebuild Snap
sudo rm -f "${FILE}"
sudo mksquashfs snap "${FILE}" -noappend -comp lzo -no-fragments
## Finalize
echo '**** Finalizing... ****'
# Mount Snap
sudo systemctl start "snap-firefox-${REV}.mount"
# Clean Up
rm -rf /tmp/jailbreak-firefox-snap-workdir
## Done
echo '**** Done! ****'
#!/bin/sh
set -e
## Prepare
echo '**** Preparing... ****'
# Create Workdir
rm -rf /tmp/jailbreak-firefox-system-workdir
mkdir /tmp/jailbreak-firefox-system-workdir
cd /tmp/jailbreak-firefox-system-workdir
## Modify
echo '**** Modifying... ****'
# Extract omni.ja
mkdir omni
unzip -q /usr/lib/firefox/omni.ja -d omni || : # Ignore Errors
# Patch AppConstants.jsm
sed -i 's/MOZ_REQUIRE_SIGNING:.*/MOZ_REQUIRE_SIGNING: false, _old_require_signing:/' omni/modules/AppConstants.sys.mjs
# Repackage omni.ja
sudo rm -f /usr/lib/firefox/omni.ja
cd omni
sudo zip -0DXqr /usr/lib/firefox/omni.ja . # Source: https://stackoverflow.com/a/68379534
cd ../
## Finalize
echo '**** Finalizing... ****'
# Clean Up
rm -rf /tmp/jailbreak-firefox-system-workdir
## Done
echo '**** Done! ****'
@IgLocoXD
Copy link

IgLocoXD commented May 1, 2023

Hey! I made a fork of your script, because there isn't a script for lib64 Firefox (for example, in Fedora), I can't make a pull request of some form, so i want it to comment it to you!

@justremember
Copy link

justremember commented Jun 24, 2023

Can't make this work for some reason. Do I have to install the addon in a special way after running the sh script? I've already tried dragging the xpi file to about:addons and still getting the same error as before: "This addon could not be installed because it has not been verified."

And yes I already checked the omni.ja file contents. The change was applied.

EDIT: my bad I forgot the about:support step.

@Thespikedballofdoom
Copy link

Genius, such an idiotic choice by mozilla

@notevenaperson
Copy link

Please apply these patches. (no pull requests on Gist)
Save this text as patches.patch then

git am < patches.patch
From 9ccaf953d02d605afb7c394e58807df5ae3bdd36 Mon Sep 17 00:00:00 2001
From: Anon <>
Date: Fri, 26 Apr 2024 10:26:14 +0100
Subject: [PATCH 1/3] make the scripts have the executable permission

---
 jailbreak-firefox-snap.sh   | 0
 jailbreak-firefox-system.sh | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 jailbreak-firefox-snap.sh
 mode change 100644 => 100755 jailbreak-firefox-system.sh

diff --git a/jailbreak-firefox-snap.sh b/jailbreak-firefox-snap.sh
old mode 100644
new mode 100755
diff --git a/jailbreak-firefox-system.sh b/jailbreak-firefox-system.sh
old mode 100644
new mode 100755
-- 
2.44.0


From 026f9e06a2b51231be157482471baee6431c0b9a Mon Sep 17 00:00:00 2001
From: Anon <>
Date: Fri, 26 Apr 2024 11:17:52 +0100
Subject: [PATCH 2/3] make writing atomic

previously, when we rm'd the original omni.ja before zipping the new
one, if zipping somehow failed the user would be left without a new
omni.ja and a broken firefox. (This hasn't happened but I anticipate it
could happen)
---
 jailbreak-firefox-system.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jailbreak-firefox-system.sh b/jailbreak-firefox-system.sh
index 6a277c3..71ecdfa 100755
--- a/jailbreak-firefox-system.sh
+++ b/jailbreak-firefox-system.sh
@@ -21,9 +21,9 @@ unzip -q /usr/lib/firefox/omni.ja -d omni || : # Ignore Errors
 sed -i 's/MOZ_REQUIRE_SIGNING:.*/MOZ_REQUIRE_SIGNING: false, _old_require_signing:/' omni/modules/AppConstants.sys.mjs
 
 # Repackage omni.ja
-sudo rm -f /usr/lib/firefox/omni.ja
 cd omni
-sudo zip -0DXqr /usr/lib/firefox/omni.ja . # Source: https://stackoverflow.com/a/68379534
+# Source: https://stackoverflow.com/a/68379534
+zip -0DXqr omni-new.ja . && sudo cp --preserve=all omni-new.ja /usr/lib/firefox/omni.ja
 cd ../
 
 ## Finalize
-- 
2.44.0


From 35f7429fe2278cc4c7823abf32d1975ce4580146 Mon Sep 17 00:00:00 2001
From: Anon <>
Date: Fri, 26 Apr 2024 11:22:36 +0100
Subject: [PATCH 3/3] rm: useless use of -f

---
 jailbreak-firefox-snap.sh   | 8 ++++----
 jailbreak-firefox-system.sh | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/jailbreak-firefox-snap.sh b/jailbreak-firefox-snap.sh
index be20f3f..aeb0e0a 100755
--- a/jailbreak-firefox-snap.sh
+++ b/jailbreak-firefox-snap.sh
@@ -16,7 +16,7 @@ sudo systemctl stop "snap-firefox-${REV}.mount"
 sudo /usr/lib/snapd/snap-discard-ns firefox
 
 # Create Workdir
-rm -rf /tmp/jailbreak-firefox-snap-workdir
+rm -r /tmp/jailbreak-firefox-snap-workdir
 mkdir /tmp/jailbreak-firefox-snap-workdir
 cd /tmp/jailbreak-firefox-snap-workdir
 
@@ -35,13 +35,13 @@ unzip -q snap/usr/lib/firefox/omni.ja -d omni || : # Ignore Errors
 sed -i 's/MOZ_REQUIRE_SIGNING:.*/MOZ_REQUIRE_SIGNING: false, _old_require_signing:/' omni/modules/AppConstants.sys.mjs
 
 # Repackage omni.ja
-rm -f snap/usr/lib/firefox/omni.ja
+rm snap/usr/lib/firefox/omni.ja
 cd omni
 zip -0DXqr ../snap/usr/lib/firefox/omni.ja . # Source: https://stackoverflow.com/a/68379534
 cd ../
 
 # Rebuild Snap
-sudo rm -f "${FILE}"
+sudo rm "${FILE}"
 sudo mksquashfs snap "${FILE}" -noappend -comp lzo -no-fragments
 
 ## Finalize
@@ -51,7 +51,7 @@ echo '**** Finalizing... ****'
 sudo systemctl start "snap-firefox-${REV}.mount"
 
 # Clean Up
-rm -rf /tmp/jailbreak-firefox-snap-workdir
+rm -r /tmp/jailbreak-firefox-snap-workdir
 
 ## Done
 echo '**** Done! ****'
diff --git a/jailbreak-firefox-system.sh b/jailbreak-firefox-system.sh
index 71ecdfa..bd292ca 100755
--- a/jailbreak-firefox-system.sh
+++ b/jailbreak-firefox-system.sh
@@ -6,7 +6,7 @@ set -e
 echo '**** Preparing... ****'
 
 # Create Workdir
-rm -rf /tmp/jailbreak-firefox-system-workdir
+rm -r /tmp/jailbreak-firefox-system-workdir
 mkdir /tmp/jailbreak-firefox-system-workdir
 cd /tmp/jailbreak-firefox-system-workdir
 
@@ -30,7 +30,7 @@ cd ../
 echo '**** Finalizing... ****'
 
 # Clean Up
-rm -rf /tmp/jailbreak-firefox-system-workdir
+rm -r /tmp/jailbreak-firefox-system-workdir
 
 ## Done
 echo '**** Done! ****'
-- 
2.44.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment