From 3a29b7bf5ba7caaaeb4c9c6bb145b0c635b03996 Mon Sep 17 00:00:00 2001 From: talyz Date: Tue, 4 May 2021 16:10:57 +0200 Subject: [PATCH] nixos/mpdscribble: Use replace-secret to avoid leaking secrets Using `replace-literal` to insert secrets leaks the secrets through the `replace-literal` process' `/proc//cmdline` file. `replace-secret` solves this by reading the secret straight from the file instead, which also simplifies the code a bit. --- nixos/modules/services/audio/mpdscribble.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/audio/mpdscribble.nix b/nixos/modules/services/audio/mpdscribble.nix index 642d8743935..1368543ae1a 100644 --- a/nixos/modules/services/audio/mpdscribble.nix +++ b/nixos/modules/services/audio/mpdscribble.nix @@ -59,7 +59,7 @@ let replaceSecret = secretFile: placeholder: targetFile: optionalString (secretFile != null) '' - ${pkgs.replace}/bin/replace-literal -ef ${placeholder} "$(cat ${secretFile})" ${targetFile}''; + ${pkgs.replace-secret}/bin/replace-secret '${placeholder}' '${secretFile}' '${targetFile}' ''; preStart = pkgs.writeShellScript "mpdscribble-pre-start" '' cp -f "${cfgTemplate}" "${cfgFile}"