From 37f7d22038e2e0a95dedf76f655519fab5b981c1 Mon Sep 17 00:00:00 2001 From: Joshua Levine Date: Wed, 16 Sep 2026 13:04:18 -0400 Subject: [PATCH 1/6] Point Zen's policy at the directory the package uses omarchy-install-browser wrote Zen's Firefox policy to /opt/zen-browser/distribution, but zen-browser-bin installs to /opt/zen-browser-bin. Nothing failed: install -d created the missing directory, so the policy landed in a path no package owns and Zen never reads, and the install reported success. The effect is that every preference Omarchy sets for Firefox-based browsers was silently dropped for Zen -- VA-API and hardware video decoding, Wayland fractional scaling, overscroll and the swipe tracker -- while leaving an orphan /opt/zen-browser behind on every machine that ran the installer. BROWSER_POLICY_FIREFOX_DIRS carried the same path, so the migration that hardens those directories was guarding the wrong one too. --- bin/omarchy-install-browser | 2 +- install/helpers/browser-policy.sh | 2 +- test/shell.d/browser-policy-dir-test.sh | 2 +- test/shell.d/default-apps-test.sh | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/omarchy-install-browser b/bin/omarchy-install-browser index 4593bc72d87b..b357b1a0b752 100755 --- a/bin/omarchy-install-browser +++ b/bin/omarchy-install-browser @@ -87,7 +87,7 @@ zen) echo "Installing Zen..." omarchy-pkg-aur-add zen-browser-bin || exit 1 - browser_policy_setup_firefox_distribution /opt/zen-browser/distribution + browser_policy_setup_firefox_distribution /opt/zen-browser-bin/distribution setup_firefox_wayland announce_browser_installed "Zen" ;; diff --git a/install/helpers/browser-policy.sh b/install/helpers/browser-policy.sh index c2c93d8e4e50..60986ae3a9e9 100644 --- a/install/helpers/browser-policy.sh +++ b/install/helpers/browser-policy.sh @@ -26,7 +26,7 @@ BROWSER_POLICY_PARENT_DIRS=( BROWSER_POLICY_FIREFOX_DIRS=( /usr/lib/firefox/distribution - /opt/zen-browser/distribution + /opt/zen-browser-bin/distribution ) BROWSER_POLICY_DEFAULT_COLOR="#1c2027" diff --git a/test/shell.d/browser-policy-dir-test.sh b/test/shell.d/browser-policy-dir-test.sh index 0d66d21666ed..174c0dc1d337 100755 --- a/test/shell.d/browser-policy-dir-test.sh +++ b/test/shell.d/browser-policy-dir-test.sh @@ -325,6 +325,6 @@ grep -F 'BROWSER_POLICY_FIREFOX_DIRS' "${migrations[0]}" >/dev/null || fail "the policy-directory migration covers Firefox and Zen" grep -F 'browser_policy_firefox_policy_file_ok' "${migrations[0]}" >/dev/null || fail "the policy-directory migration keeps a trusted Firefox policies.json" -grep -F '/opt/zen-browser/distribution' "$ROOT/install/helpers/browser-policy.sh" >/dev/null || +grep -F '/opt/zen-browser-bin/distribution' "$ROOT/install/helpers/browser-policy.sh" >/dev/null || fail "the shared helper names the Zen distribution directory" pass "a migration locks existing policy directories" diff --git a/test/shell.d/default-apps-test.sh b/test/shell.d/default-apps-test.sh index 8151c250fd21..9ad8ed1616b8 100755 --- a/test/shell.d/default-apps-test.sh +++ b/test/shell.d/default-apps-test.sh @@ -248,11 +248,11 @@ rm -f "$installed_dir/zen-browser" OMARCHY_TEST_REAL_BROWSER_INSTALL=true omarchy-default-browser --install zen >/dev/null [[ $(<"$install_log") == "pkg:zen-browser-bin" ]] || fail "Zen browser installer installs the package" [[ $(omarchy-default-browser) == "zen" ]] || fail "Zen becomes the default after its full installer succeeds" -grep -Fxq 'sudo:install -d -m 0755 -o root -g root /opt/zen-browser/distribution' "$setup_log" || +grep -Fxq 'sudo:install -d -m 0755 -o root -g root /opt/zen-browser-bin/distribution' "$setup_log" || fail "Zen browser installer creates its distribution directory" -grep -Fxq 'sudo:find /opt/zen-browser/distribution -mindepth 1 -maxdepth 1 ! -user root -exec rm -rf -- {} +' "$setup_log" || +grep -Fxq 'sudo:find /opt/zen-browser-bin/distribution -mindepth 1 -maxdepth 1 ! -user root -exec rm -rf -- {} +' "$setup_log" || fail "Zen browser installer drops non-root files from its distribution directory" -grep -Fxq "sudo:install -m 644 -o root -g root -T $ROOT/default/firefox/policies.json /opt/zen-browser/distribution/policies.json" "$setup_log" || +grep -Fxq "sudo:install -m 644 -o root -g root -T $ROOT/default/firefox/policies.json /opt/zen-browser-bin/distribution/policies.json" "$setup_log" || fail "Zen browser installer copies policies.json without following a destination symlink" [[ -e $installed_dir/zen-browser ]] || fail "Zen browser installer marks zen-browser installed" pass "Zen browser installer restores the complete Omarchy setup" From f3ab9c95407f4008ead17fb177bec3d108bc1811 Mon Sep 17 00:00:00 2001 From: Joshua Levine Date: Wed, 16 Sep 2026 13:08:17 -0400 Subject: [PATCH 2/6] Keep Zen's own policies when installing Omarchy's zen-browser-bin ships distribution/policies.json carrying DisableAppUpdate and DefaultSerialGuardSetting. Now that the path is right, install -T lands on that file, so Omarchy's policy would replace the vendor's and let a browser pacman manages start updating itself behind the package manager. browser_policy_setup_firefox_distribution already takes the policies file as its second argument, so give Zen its own: the same preferences Firefox gets, plus the two keys the package sets. Nothing else changes, and Firefox keeps using the stock file -- its package ships distribution.ini but no policies.json, so there is nothing there to preserve. --- bin/omarchy-install-browser | 3 ++- default/firefox/zen-policies.json | 28 ++++++++++++++++++++++++++++ test/shell.d/default-apps-test.sh | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 default/firefox/zen-policies.json diff --git a/bin/omarchy-install-browser b/bin/omarchy-install-browser index b357b1a0b752..e1e290d0192a 100755 --- a/bin/omarchy-install-browser +++ b/bin/omarchy-install-browser @@ -87,7 +87,8 @@ zen) echo "Installing Zen..." omarchy-pkg-aur-add zen-browser-bin || exit 1 - browser_policy_setup_firefox_distribution /opt/zen-browser-bin/distribution + browser_policy_setup_firefox_distribution /opt/zen-browser-bin/distribution \ + "$OMARCHY_PATH/default/firefox/zen-policies.json" setup_firefox_wayland announce_browser_installed "Zen" ;; diff --git a/default/firefox/zen-policies.json b/default/firefox/zen-policies.json new file mode 100644 index 000000000000..9c58de55ef59 --- /dev/null +++ b/default/firefox/zen-policies.json @@ -0,0 +1,28 @@ +{ + "policies": { + "DisableAppUpdate": true, + "DefaultSerialGuardSetting": 3, + "Preferences": { + "apz.overscroll.enabled": { + "Value": true, + "Status": "default" + }, + "media.ffmpeg.vaapi.enabled": { + "Value": true, + "Status": "default" + }, + "media.hardware-video-decoding.force-enabled": { + "Value": true, + "Status": "default" + }, + "widget.disable-swipe-tracker": { + "Value": false, + "Status": "default" + }, + "widget.wayland.fractional-scale.enabled": { + "Value": true, + "Status": "default" + } + } + } +} diff --git a/test/shell.d/default-apps-test.sh b/test/shell.d/default-apps-test.sh index 9ad8ed1616b8..034340f615fe 100755 --- a/test/shell.d/default-apps-test.sh +++ b/test/shell.d/default-apps-test.sh @@ -252,7 +252,7 @@ grep -Fxq 'sudo:install -d -m 0755 -o root -g root /opt/zen-browser-bin/distribu fail "Zen browser installer creates its distribution directory" grep -Fxq 'sudo:find /opt/zen-browser-bin/distribution -mindepth 1 -maxdepth 1 ! -user root -exec rm -rf -- {} +' "$setup_log" || fail "Zen browser installer drops non-root files from its distribution directory" -grep -Fxq "sudo:install -m 644 -o root -g root -T $ROOT/default/firefox/policies.json /opt/zen-browser-bin/distribution/policies.json" "$setup_log" || +grep -Fxq "sudo:install -m 644 -o root -g root -T $ROOT/default/firefox/zen-policies.json /opt/zen-browser-bin/distribution/policies.json" "$setup_log" || fail "Zen browser installer copies policies.json without following a destination symlink" [[ -e $installed_dir/zen-browser ]] || fail "Zen browser installer marks zen-browser installed" pass "Zen browser installer restores the complete Omarchy setup" From ecc90cbb543b317deccb925d2b737d411d4373ab Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Sun, 1 Nov 2026 11:26:34 +0100 Subject: [PATCH 3/6] Give Zen the default browser policy Firefox gets quattro added DontCheckDefaultBrowser to default/firefox/policies.json so Firefox-based browsers stop asking to be the default behind Omarchy's link routing (#14441). zen-policies.json was copied from the stock file before that, so Zen would still ask. Add the key, and test that Zen's file carries every policy the stock one does so the two cannot drift again. Co-Authored-By: Claude Opus 5.5 --- default/firefox/zen-policies.json | 1 + test/shell.d/browser-policy-dir-test.sh | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/default/firefox/zen-policies.json b/default/firefox/zen-policies.json index 9c58de55ef59..994f69643fc8 100644 --- a/default/firefox/zen-policies.json +++ b/default/firefox/zen-policies.json @@ -2,6 +2,7 @@ "policies": { "DisableAppUpdate": true, "DefaultSerialGuardSetting": 3, + "DontCheckDefaultBrowser": true, "Preferences": { "apz.overscroll.enabled": { "Value": true, diff --git a/test/shell.d/browser-policy-dir-test.sh b/test/shell.d/browser-policy-dir-test.sh index c2b8988263d2..d32639ff545a 100755 --- a/test/shell.d/browser-policy-dir-test.sh +++ b/test/shell.d/browser-policy-dir-test.sh @@ -315,6 +315,11 @@ grep -F '/opt/zen-browser-bin/distribution' "$ROOT/install/helpers/browser-polic fail "the shared helper names the Zen distribution directory" pass "the shared helper names the Zen distribution directory" +# Zen ships its own copy so the package's keys survive; it must not fall behind the stock file. +[[ $(jq -c '.policies | del(.DisableAppUpdate, .DefaultSerialGuardSetting)' "$ROOT/default/firefox/zen-policies.json") == $(jq -c '.policies' "$ROOT/default/firefox/policies.json") ]] || + fail "Zen's policies carry every policy Firefox gets" +pass "Zen's policies carry every policy Firefox gets" + fx_merge=$test_tmp/fx-merge mkdir -p "$fx_merge" printf '{"policies": {"DisableTelemetry": true}}\n' >"$fx_merge/policies.json" From f0903beb8b3577f38170f355e5317b158c2d363a Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Sun, 1 Nov 2026 11:38:42 +0100 Subject: [PATCH 4/6] Check Zen's own policy keys and compare policies structurally The drift test deleted Zen's two package keys before comparing, so it passed with them missing, and compared jq output in file order, so reordering keys failed it. Assert the two keys explicitly and sort keys on both sides. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: Codex Medium --- test/shell.d/browser-policy-dir-test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/shell.d/browser-policy-dir-test.sh b/test/shell.d/browser-policy-dir-test.sh index d32639ff545a..30ff9e2da786 100755 --- a/test/shell.d/browser-policy-dir-test.sh +++ b/test/shell.d/browser-policy-dir-test.sh @@ -316,7 +316,9 @@ grep -F '/opt/zen-browser-bin/distribution' "$ROOT/install/helpers/browser-polic pass "the shared helper names the Zen distribution directory" # Zen ships its own copy so the package's keys survive; it must not fall behind the stock file. -[[ $(jq -c '.policies | del(.DisableAppUpdate, .DefaultSerialGuardSetting)' "$ROOT/default/firefox/zen-policies.json") == $(jq -c '.policies' "$ROOT/default/firefox/policies.json") ]] || +jq -e '.policies.DisableAppUpdate == true and .policies.DefaultSerialGuardSetting == 3' "$ROOT/default/firefox/zen-policies.json" >/dev/null || + fail "Zen's policies keep the package's own keys" +[[ $(jq -cS '.policies | del(.DisableAppUpdate, .DefaultSerialGuardSetting)' "$ROOT/default/firefox/zen-policies.json") == $(jq -cS '.policies' "$ROOT/default/firefox/policies.json") ]] || fail "Zen's policies carry every policy Firefox gets" pass "Zen's policies carry every policy Firefox gets" From f31077e755dcfecb756ec1722f75acc141ef2f1b Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:15:52 +0100 Subject: [PATCH 5/6] Repair Zen's policy directory with Zen's own policies The browser-policy hardening migration repairs every directory in BROWSER_POLICY_FIREFOX_DIRS by calling browser_policy_install_firefox_policies with no file, which installed Firefox's stock policies. Now that the list names Zen's real directory, a repair there would drop the package's DisableAppUpdate and DefaultSerialGuardSetting. The helper now picks the file by directory, so the shipped migration, the installer and any later caller get zen-policies.json for Zen without naming it. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: Codex Medium Co-Authored-By: muse-wonder High --- bin/omarchy-install-browser | 3 +-- install/helpers/browser-policy.sh | 14 +++++++++++--- test/shell.d/browser-policy-dir-test.sh | 7 +++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bin/omarchy-install-browser b/bin/omarchy-install-browser index 0673282e5df1..a254f56e35c7 100755 --- a/bin/omarchy-install-browser +++ b/bin/omarchy-install-browser @@ -109,8 +109,7 @@ zen) echo "Installing Zen..." omarchy-pkg-aur-add zen-browser-bin || exit 1 - browser_policy_setup_firefox_distribution /opt/zen-browser-bin/distribution \ - "$OMARCHY_PATH/default/firefox/zen-policies.json" + browser_policy_setup_firefox_distribution /opt/zen-browser-bin/distribution setup_firefox_wayland omarchy-lifecycle-dispatch post-install zen announce_browser_installed "Zen" diff --git a/install/helpers/browser-policy.sh b/install/helpers/browser-policy.sh index ce6e65149b78..fb1085a6a578 100644 --- a/install/helpers/browser-policy.sh +++ b/install/helpers/browser-policy.sh @@ -162,9 +162,18 @@ browser_policy_firefox_hardened() { browser_policy_firefox_policy_file_ok "$dir/policies.json" } +# Zen's package ships a policies.json of its own, so its replacement keeps those keys. +browser_policy_firefox_default_policies() { + if [[ $1 == "/opt/zen-browser-bin/distribution" ]]; then + echo "$OMARCHY_PATH/default/firefox/zen-policies.json" + else + echo "$OMARCHY_PATH/default/firefox/policies.json" + fi +} + browser_policy_install_firefox_policies() { local distribution_dir=$1 - local policies=${2:-$OMARCHY_PATH/default/firefox/policies.json} + local policies=${2:-$(browser_policy_firefox_default_policies "$distribution_dir")} as_root install -m 644 -o root -g root -T "$policies" "$distribution_dir/policies.json" } @@ -187,9 +196,8 @@ browser_policy_firefox_skip_default_check() { browser_policy_setup_firefox_distribution() { local distribution_dir=$1 - local policies=${2:-$OMARCHY_PATH/default/firefox/policies.json} browser_policy_setup_parent "$distribution_dir" browser_policy_purge_dir "$distribution_dir" - browser_policy_install_firefox_policies "$distribution_dir" "$policies" + browser_policy_install_firefox_policies "$distribution_dir" "${2:-}" } diff --git a/test/shell.d/browser-policy-dir-test.sh b/test/shell.d/browser-policy-dir-test.sh index 30ff9e2da786..100d0be27af7 100755 --- a/test/shell.d/browser-policy-dir-test.sh +++ b/test/shell.d/browser-policy-dir-test.sh @@ -322,6 +322,13 @@ jq -e '.policies.DisableAppUpdate == true and .policies.DefaultSerialGuardSettin fail "Zen's policies carry every policy Firefox gets" pass "Zen's policies carry every policy Firefox gets" +# The hardening migration repairs every directory without naming a file; Zen's must not lose its keys. +[[ $(browser_policy_firefox_default_policies /opt/zen-browser-bin/distribution) == "$ROOT/default/firefox/zen-policies.json" ]] || + fail "a Zen policy repair installs Zen's own policies" +[[ $(browser_policy_firefox_default_policies /usr/lib/firefox/distribution) == "$ROOT/default/firefox/policies.json" ]] || + fail "a Firefox policy repair installs the stock policies" +pass "each Firefox distribution is repaired with its own policies" + fx_merge=$test_tmp/fx-merge mkdir -p "$fx_merge" printf '{"policies": {"DisableTelemetry": true}}\n' >"$fx_merge/policies.json" From 05b50ab59d08024ba0b4be818924938992f8a758 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Tue, 17 Nov 2026 01:12:11 +0100 Subject: [PATCH 6/6] Drop the tests that restate the implementation One grepped the helper for Zen's path and one re-read zen-policies.json for the two package keys it was written with; AGENTS.md rules out both. The mapping test and default-apps-test.sh's installer assertions still check where Zen's policies go, and the parity check still catches the two policy files drifting apart. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: Codex Medium Co-Authored-By: muse-wonder High --- test/shell.d/browser-policy-dir-test.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/shell.d/browser-policy-dir-test.sh b/test/shell.d/browser-policy-dir-test.sh index 100d0be27af7..3b8ec930beba 100755 --- a/test/shell.d/browser-policy-dir-test.sh +++ b/test/shell.d/browser-policy-dir-test.sh @@ -311,13 +311,7 @@ if grep -nE 'chmod a\+rwx\b|chmod a\+rw\b|chmod a\+w\b|chmod o\+w|chmod ugo\+w|c fi pass "browser policy setup is not world-writable" -grep -F '/opt/zen-browser-bin/distribution' "$ROOT/install/helpers/browser-policy.sh" >/dev/null || - fail "the shared helper names the Zen distribution directory" -pass "the shared helper names the Zen distribution directory" - # Zen ships its own copy so the package's keys survive; it must not fall behind the stock file. -jq -e '.policies.DisableAppUpdate == true and .policies.DefaultSerialGuardSetting == 3' "$ROOT/default/firefox/zen-policies.json" >/dev/null || - fail "Zen's policies keep the package's own keys" [[ $(jq -cS '.policies | del(.DisableAppUpdate, .DefaultSerialGuardSetting)' "$ROOT/default/firefox/zen-policies.json") == $(jq -cS '.policies' "$ROOT/default/firefox/policies.json") ]] || fail "Zen's policies carry every policy Firefox gets" pass "Zen's policies carry every policy Firefox gets"