Skip to content

Instantly share code, notes, and snippets.

@hafta
Last active November 9, 2023 21:52
Show Gist options
  • Save hafta/08c7965bdd2fdfed98aeffbbe17ec59d to your computer and use it in GitHub Desktop.
Save hafta/08c7965bdd2fdfed98aeffbbe17ec59d to your computer and use it in GitHub Desktop.
Re-sign the Firefox release bundle using rcodesign and the entitlements from the mozilla-central repo. Set $MOZILLA_CENTRAL to be the path to the local clone of the mozilla-central repo.
#!/bin/bash
set -x
cp -r /Applications/Firefox.app .
find Firefox.app -type f -exec codesign --remove-signature {} \;
xattr -cr Firefox.app
cat << EOF > empty.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
EOF
rcodesign sign \
--p12-file ./myDevId.p12 \
--p12-password-file ./myDevId.p12.passwd \
--code-signature-flags runtime \
--entitlements-xml-path ${MOZILLA_CENTRAL}/security/mac/hardenedruntime/v2/production/browser.xml \
--entitlements-xml-path Contents/MacOS/plugin-container.app:${MOZILLA_CENTRAL}/security/mac/hardenedruntime/v2/production/plugin-container.xml \
--entitlements-xml-path Contents/MacOS/media-plugin-helper.app:${MOZILLA_CENTRAL}/security/mac/hardenedruntime/v2/production/media-plugin-helper.xml \
--entitlements-xml-path Contents/MacOS/pingsender:./empty.xml \
--entitlements-xml-path Contents/MacOS/minidump-analyzer:./empty.xml \
--entitlements-xml-path Contents/MacOS/updater.app:./empty.xml \
--entitlements-xml-path Contents/MacOS/crashreporter.app:./empty.xml \
--entitlements-xml-path Contents/MacOS/XUL:./empty.xml \
--entitlements-xml-path Contents/MacOS/libfreebl3.dylib:./empty.xml \
--entitlements-xml-path Contents/MacOS/liblgpllibs.dylib:./empty.xml \
--entitlements-xml-path Contents/MacOS/libsoftokn3.dylib:./empty.xml \
--entitlements-xml-path Contents/MacOS/libosclientcerts.dylib:./empty.xml \
--entitlements-xml-path Contents/MacOS/libmozavutil.dylib:./empty.xml \
--entitlements-xml-path Contents/MacOS/libmozglue.dylib:./empty.xml \
--entitlements-xml-path Contents/MacOS/libgkcodecs.dylib:./empty.xml \
--entitlements-xml-path Contents/MacOS/libipcclientcerts.dylib:./empty.xml \
--entitlements-xml-path Contents/MacOS/libmozavcodec.dylib:./empty.xml \
--entitlements-xml-path Contents/MacOS/libnssckbi.dylib:./empty.xml \
--entitlements-xml-path Contents/MacOS/libnss3.dylib:./empty.xml \
--entitlements-xml-path Contents/Resources/gmp-clearkey/0.1/libclearkey.dylib:./empty.xml \
--entitlements-xml-path Contents/Library/LaunchServices/org.mozilla.updater:./empty.xml \
Firefox.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment