aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2020-08-29 18:22:03 +0200
committerRobert Helgesson <robert@rycee.net>2020-08-29 18:22:03 +0200
commit4fe5afa7557e1f135b02ca9adef7c592852adccb (patch)
tree3ef33721b8066caefba5b64ffb805c21f0b81d87 /modules
parent209fb62d4983f1219f10b2e89debd169549161b1 (diff)
files: make sure the target file name is escaped
The previous implementation would allow variables to sneak into the file names. This commit makes sure the resulting target file path exactly matches the expected path.
Diffstat (limited to 'modules')
-rw-r--r--modules/files.nix15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/files.nix b/modules/files.nix
index e0ad8facac1..09ecf715497 100644
--- a/modules/files.nix
+++ b/modules/files.nix
@@ -316,12 +316,15 @@ in
}
'' + concatStrings (
mapAttrsToList (n: v: ''
- insertFile "${sourceStorePath v}" \
- "${v.target}" \
- "${if v.executable == null
- then "inherit"
- else builtins.toString v.executable}" \
- "${builtins.toString v.recursive}"
+ insertFile ${
+ escapeShellArgs [
+ (sourceStorePath v)
+ v.target
+ (if v.executable == null
+ then "inherit"
+ else toString v.executable)
+ (toString v.recursive)
+ ]}
'') cfg
));
};