summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers/firefox/wrapper.nix
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2023-09-05 16:28:57 +0200
committerrnhmjoj <rnhmjoj@inventati.org>2023-09-05 16:28:57 +0200
commit800133566d79ba66faec6f2aca40f9e52b6a7c4d (patch)
treebe573b5e7e36721510541654a73e07ff363d8c05 /pkgs/applications/networking/browsers/firefox/wrapper.nix
parentf9967a1d7688a6de0c727fec0c4b61715064fe1b (diff)
downloadnixpkgs-800133566d79ba66faec6f2aca40f9e52b6a7c4d.tar
nixpkgs-800133566d79ba66faec6f2aca40f9e52b6a7c4d.tar.gz
nixpkgs-800133566d79ba66faec6f2aca40f9e52b6a7c4d.tar.bz2
nixpkgs-800133566d79ba66faec6f2aca40f9e52b6a7c4d.tar.lz
nixpkgs-800133566d79ba66faec6f2aca40f9e52b6a7c4d.tar.xz
nixpkgs-800133566d79ba66faec6f2aca40f9e52b6a7c4d.tar.zst
nixpkgs-800133566d79ba66faec6f2aca40f9e52b6a7c4d.zip
firefox wrapper: fix merging of policies files
If multiple extraPolicies or extraPoliciesFiles are given, the JSON
objects are merged using `jq` with the `a + b` operator, which simply
combines all the unique keys of `a`, `b` with the duplicated keys from
`b`, without recursion.
This strategy is completely wrong in this case: as policy files consists
of a single key, "policies", all that happens is that `b` takes over, in
other words:

    $(jq -s '.[0] + .[1]' a b) == $(cat b)

So there is no merging at all, the final policies.json file is simply
the last file in the list.

The `a * b` operation should be used instead, which performs the merge
by recursing in each key.
Diffstat (limited to 'pkgs/applications/networking/browsers/firefox/wrapper.nix')
-rw-r--r--pkgs/applications/networking/browsers/firefox/wrapper.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix
index e909b15f77a..12924180c25 100644
--- a/pkgs/applications/networking/browsers/firefox/wrapper.nix
+++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix
@@ -362,7 +362,7 @@ let
 
         extraPoliciesFiles=(${builtins.toString extraPoliciesFiles})
         for extraPoliciesFile in "''${extraPoliciesFiles[@]}"; do
-          jq -s '.[0] + .[1]' "$POL_PATH" $extraPoliciesFile > .tmp.json
+          jq -s '.[0] * .[1]' "$POL_PATH" $extraPoliciesFile > .tmp.json
           mv .tmp.json "$POL_PATH"
         done