Allow relative paths anywhere into the parent's store path
This commit is contained in:
parent
5cbb9c5406
commit
06557299b3
1 changed files with 5 additions and 2 deletions
|
@ -95,8 +95,11 @@ struct PathInputScheme : InputScheme
|
|||
absPath = nix::absPath(path, parent);
|
||||
|
||||
// for security, ensure that if the parent is a store path, it's inside it
|
||||
if (store->isInStore(parent) && !isInDir(absPath, parent))
|
||||
throw BadStorePath("relative path '%s' [%s] points outside of its parent's store path '%s'", path, absPath, parent);
|
||||
if (store->isInStore(parent)) {
|
||||
auto storePath = store->printStorePath(store->toStorePath(parent).first);
|
||||
if (!isInDir(absPath, storePath))
|
||||
throw BadStorePath("relative path '%s' points outside of its parent's store path '%s'", path, storePath);
|
||||
}
|
||||
} else
|
||||
absPath = path;
|
||||
|
||||
|
|
Loading…
Reference in a new issue