From a24ea6781e6319b84aed23d9397ed032000263cc Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Mon, 13 Jul 2026 14:57:24 +0300 Subject: [PATCH] Harden macOS uninstall script WE2-1251 Signed-off-by: Raul Metsma --- debian/web-eid-firefox.postrm | 3 +++ install/uninstall.sh | 31 +++++++++++++++++++++++++------ install/web-eid.wxs | 22 ++++++++++++++++++++-- 3 files changed, 48 insertions(+), 8 deletions(-) diff --git a/debian/web-eid-firefox.postrm b/debian/web-eid-firefox.postrm index d4913019..bec4c401 100644 --- a/debian/web-eid-firefox.postrm +++ b/debian/web-eid-firefox.postrm @@ -9,6 +9,9 @@ if [ ! -f ${POLICIES}/policies.json ]; then else JQARGS=${POLICIES}/policies.json; fi +# Block the extension so it can't be reinstalled from AMO without the native app, avoiding a +# dangling, non-functional extension. Reinstalling web-eid-firefox overwrites this back to +# "normal_installed" (see debian/web-eid-firefox.postinst), so this is not a permanent block. jq '.policies.ExtensionSettings["{e68418bc-f2b0-4459-a9ea-3e72b6751b07}"] = {"installation_mode": "blocked"}' ${JQARGS} > ${POLICIES}/policies.tmp mv ${POLICIES}/policies.tmp ${POLICIES}/policies.json diff --git a/install/uninstall.sh b/install/uninstall.sh index 911ca82e..e76e3d2a 100755 --- a/install/uninstall.sh +++ b/install/uninstall.sh @@ -1,11 +1,30 @@ #!/bin/bash +set -euo pipefail + +echo "This will remove Web eID and its browser integration files. Administrator" \ + "privileges are required." +read -r -p "Continue? [y/N] " confirm +case "${confirm}" in + [yY]|[yY][eE][sS]) ;; + *) echo "Aborted."; exit 1 ;; +esac + +# Prompt for the admin password once up front; the sudo calls below reuse this ticket. +sudo -v + sudo rm -rf \ - /Applications/Utilities/web-eid.app \ - /Applications/Utilities/web-eid-safari.app \ - /Library/Google/Chrome/NativeMessagingHosts/eu.webeid.json \ - /Library/Application\ Support/Mozilla/NativeMessagingHosts/eu.webeid.json \ - /Library/Application\ Support/Google/Chrome/External\ Extensions/ncibgoaomkmdpilpocfeponihegamlic.json + "/Applications/Utilities/web-eid.app" \ + "/Applications/Utilities/web-eid-safari.app" \ + "/Library/Google/Chrome/NativeMessagingHosts/eu.webeid.json" \ + "/Library/Application Support/Mozilla/NativeMessagingHosts/eu.webeid.json" \ + "/Library/Application Support/Google/Chrome/External Extensions/ncibgoaomkmdpilpocfeponihegamlic.json" + PLIST=/Library/Preferences/org.mozilla.firefox.plist -sudo defaults write ${PLIST} ExtensionSettings \ +# Block the extension so it can't be reinstalled from AMO without the native app, avoiding a +# dangling, non-functional extension. Reinstalling Web eID overwrites this back to +# 'normal_installed' (see install/macos-postinstall.in), so this is not a permanent block. +sudo defaults write "${PLIST}" ExtensionSettings \ -dict-add "'{e68418bc-f2b0-4459-a9ea-3e72b6751b07}'" "{ 'installation_mode' = 'blocked'; }" + +echo "Web eID has been uninstalled." diff --git a/install/web-eid.wxs b/install/web-eid.wxs index 8e45aa14..5f2c2645 100644 --- a/install/web-eid.wxs +++ b/install/web-eid.wxs @@ -63,6 +63,10 @@ Condition="FIREFOXINSTALL=1 AND NOT REMOVE="ALL"" /> + @@ -110,12 +114,23 @@ - + + @@ -124,12 +139,15 @@ - + +