From f4b2813dbba3be9f553750e46c2ccca73ebcebbe Mon Sep 17 00:00:00 2001 From: Atemu Date: Sat, 8 Aug 2026 15:51:08 +0200 Subject: [PATCH] firefox: do not allow lossy silent downgrades I just lost my cookies and container state due to accidental rollback of Firefox. I had snapshots, so I'm fine, but firefox should *not* be doing that. The user should explicitly opt into this by either setting that env var themselves or by using `-allow-downgrade`; as upstream intends. This partially reverts 87e261843c4236c541ee0113988286f77d2fa1ee. I made this an overrideable option since this would be quite annoying to override otherwise in case people actually want it to behave like that. (cherry picked from commit 73e297c4a04cc04d0856f23c8973e2c4c075ef91) --- nixos/doc/manual/release-notes/rl-2611.section.md | 5 +++++ pkgs/applications/networking/browsers/firefox/wrapper.nix | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/release-notes/rl-2611.section.md b/nixos/doc/manual/release-notes/rl-2611.section.md index b79405846542..262419e87126 100644 --- a/nixos/doc/manual/release-notes/rl-2611.section.md +++ b/nixos/doc/manual/release-notes/rl-2611.section.md @@ -409,6 +409,11 @@ - The full-text search backend changed from Whoosh to Tantivy. The search index is rebuilt automatically on the first start after upgrading, which can take a while for large document sets. - Some settings changed or were removed (for example, an external database now needs an explicit `PAPERLESS_DBENGINE`); review your `services.paperless.settings` against the migration guide. +- `firefox` no longer defaults to allowing silent downgrades that can lead to loss of important browser state. + This matches the behaviour which upstream Firefox has intended since version 67. + In case of an intended or necessary downgrade, users are advised to use the [`-allow-downgrade` CLI argument](https://wiki.mozilla.org/Firefox/CommandLineOptions#-allow-downgrade) or `MOZ_ALLOW_DOWNGRADE=1` environment variable to accept the risk of data loss and continue using the profile. + Users who frequently downgrade Firefox versions can use the `allowDowngrade` override to restore the previous behaviour of setting the environment variable by default. + - `services.alps` has been rewritten, see [upstream repository](https://github.com/migadu/alps) for configuration. - Nginx no longer includes the unmaintained dav module per default. diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix index 3ba423c8677c..a8c04f9f89e1 100644 --- a/pkgs/applications/networking/browsers/firefox/wrapper.nix +++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix @@ -76,6 +76,10 @@ let libName ? browser.libName or applicationName, # Important for tor package or the like nixExtensions ? null, hasMozSystemDirPatch ? (lib.hasPrefix "firefox" pname && !lib.hasSuffix "-bin" pname), + # Using a profile last written to by a newer version of firefox is + # possible in many cases but can lead to partial data loss without + # warning. This flag allows opting into that behaviour. + allowDowngrade ? false, }: let @@ -329,7 +333,8 @@ let "--set" "MOZ_LEGACY_PROFILES" "1" - + ] + ++ lib.optionals allowDowngrade [ "--set" "MOZ_ALLOW_DOWNGRADE" "1"