Make our browser customization more future-proof with policies.json

intrigeri
2025-03-10T09:07:17Z

We have a bunch of hacks that we're worried will break sooner or later. We could get rid of some of those hacks if we used the Firefox policies.json mechanism: https://support.mozilla.org/en-US/kb/customizing-firefox-using-policiesjson.

In particular, this could avoid shipping a hand-crafted addonStartup.json.lz4, but we provided more examples on https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/31978#note_2667517.

How: ship a distribution/policies.json policy file in the Tor Browser installation directory. We already do this via config/chroot_local-hooks/10-tbb. Next step is to migrate more tweaks there.

Since https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/32418, Tor Browser is supposed to allow this policy file, and none other: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/681ae05290b7550f3e8fdf6ef5c7cf6c8683aa04.