nix-gh/src
aszlig 43e28a1b75
Fix symlink leak in restricted eval mode
In EvalState::checkSourcePath, the path is checked against the list of
allowed paths first and later it's checked again *after* resolving
symlinks.

The resolving of the symlinks is done via canonPath, which also strips
out "../" and "./". However after the canonicalisation the error message
pointing out that the path is not allowed prints the symlink target in
the error message.

Even if we'd suppress the message, symlink targets could still be leaked
if the symlink target doesn't exist (in this case the error is thrown in
canonPath).

So instead, we now do canonPath() without symlink resolving first before
even checking against the list of allowed paths and then later do the
symlink resolving and checking the allowed paths again.

The first call to canonPath() should get rid of all the "../" and "./",
so in theory the only way to leak a symlink if the attacker is able to
put a symlink in one of the paths allowed by restricted evaluation mode.

For the latter I don't think this is part of the threat model, because
if the attacker can write to that path, the attack vector is even
larger.

Signed-off-by: aszlig <aszlig@nix.build>
2018-08-03 06:46:43 +02:00
..
build-remote Merge branch 'aarch64-armv7' of git://github.com/lheckemann/nix 2018-04-23 08:48:22 -04:00
cpptoml Include cpptoml for build simplicity 2018-07-03 18:39:36 +02:00
libexpr Fix symlink leak in restricted eval mode 2018-08-03 06:46:43 +02:00
libmain Modularize config settings 2018-05-30 13:28:01 +02:00
libstore Detect redirect loops 2018-06-18 10:36:19 +02:00
libutil Store floating point numbers in double precision 2018-07-03 18:39:32 +02:00
linenoise linenoise.cpp: allow completions from empty input 2017-12-19 12:52:10 -06:00
nix Merge pull request #2250 from dtzWill/feature/repl-progress-bar-builds 2018-07-06 21:36:37 +02:00
nix-build Move EvalState from the stack to the heap 2018-06-12 17:49:55 +02:00
nix-channel make sure not to use cached channels for nix-channel --update 2018-05-09 16:18:20 +02:00
nix-collect-garbage Add plugins to make Nix more extensible. 2018-02-08 12:44:37 -05:00
nix-copy-closure Fix library ordering in Makefiles 2018-04-21 21:10:52 -07:00
nix-daemon nix-daemon: Respect --store 2018-07-03 19:52:32 +02:00
nix-env Merge pull request #767 from mogorman/garbage_collect_keep_last_few 2018-05-31 10:00:21 +02:00
nix-instantiate Move EvalState from the stack to the heap 2018-06-12 17:49:55 +02:00
nix-prefetch-url Move EvalState from the stack to the heap 2018-06-12 17:49:55 +02:00
nix-store Fix some random -Wconversion warnings 2018-05-02 13:56:34 +02:00
nlohmann nlohmann-json: 2.1.1 -> 3.0.1 2018-01-22 12:19:50 -06:00
resolve-system-dependencies Replace Unicode quotes in user-facing strings by ASCII 2017-07-30 12:32:45 +01:00