mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
fix env-vars beeing written to /tmp
This overall seems like insecure tmp file handling to me. Because other users could replace files in /tmp with a symlink and make the nix-shell override other files. fixes https://github.com/NixOS/nix/issues/11470
This commit is contained in:
parent
1ed166315c
commit
2105574702
2 changed files with 14 additions and 12 deletions
|
@ -31,6 +31,15 @@ output=$(nix-shell --pure --keep SELECTED_IMPURE_VAR "$shellDotNix" -A shellDrv
|
|||
|
||||
[ "$output" = " - foo - bar - baz" ]
|
||||
|
||||
# test NIX_BUILD_TOP
|
||||
testTmpDir=$(pwd)/nix-shell
|
||||
mkdir -p "$testTmpDir"
|
||||
output=$(TMPDIR="$testTmpDir" nix-shell --pure "$shellDotNix" -A shellDrv --run 'echo $NIX_BUILD_TOP')
|
||||
[[ "$output" =~ ${testTmpDir}.* ]] || {
|
||||
echo "expected $output =~ ${testTmpDir}.*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Test nix-shell on a .drv
|
||||
[[ $(nix-shell --pure $(nix-instantiate "$shellDotNix" -A shellDrv) --run \
|
||||
'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX - $TEST_inNixShell"') = " - foo - bar - false" ]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue