git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/tests/signal-desktop: test if the SQLite DB is (un)encrypted

Well, this should test if the database is encrypted but currently it is still unencrypted and we need to notice if this behaviour changes in the future (as it will cause data loss, see e.g. #108772). Anyway, this doesn't really matter for security reasons but we need this test to prevent data loss (unfortunately Signal-Desktop and SQLCipher handle this badly... :o).

commit217f268534ff57ec10d02c5cc569ac7dde542b01 authorMichael Weiss <dev.primeos@gmail.com> dateTue 11 May 2021, 22:04 (6 years ago) parentd4a651f
1 file changed+14−2
nixos/tests/signal-desktop.nix+14−2
nixos/tests/signal-desktop.nix+14−2
@@ -3,7 +3,7 @@ import ./make-test-python.nix ({ pkgs, ...} :
33{
44 name = "signal-desktop";
55 meta = with pkgs.lib.maintainers; {
6− maintainers = [ flokli ];
6+ maintainers = [ flokli primeos ];
77 };
88
99 machine = { ... }:
@@ -16,7 +16,7 @@ import ./make-test-python.nix ({ pkgs, ...} :
1616
1717 services.xserver.enable = true;
1818 test-support.displayManager.auto.user = "alice";
19− environment.systemPackages = [ pkgs.signal-desktop ];
19+ environment.systemPackages = with pkgs; [ signal-desktop file ];
2020 virtualisation.memorySize = 1024;
2121 };
2222
@@ -39,5 +39,17 @@ import ./make-test-python.nix ({ pkgs, ...} :
3939 machine.wait_for_text("Signal")
4040 machine.wait_for_text("File Edit View Window Help")
4141 machine.screenshot("signal_desktop")
42+
43+ # Test if the database is encrypted to prevent these issues:
44+ # - https://github.com/NixOS/nixpkgs/issues/108772
45+ # - https://github.com/NixOS/nixpkgs/pull/117555
46+ print(machine.succeed("su - alice -c 'file ~/.config/Signal/sql/db.sqlite'"))
47+ # TODO: The DB should be encrypted and the following should be machine.fail
48+ # instead of machine.succeed but the DB is currently unencrypted and we
49+ # want to notice if this isn't the case anymore as the transition to a
50+ # encrypted DB can cause data loss!:
51+ machine.succeed(
52+ "su - alice -c 'file ~/.config/Signal/sql/db.sqlite' | grep -i sqlite"
53+ )
4254 '';
4355})