Add restricted evaluation mode
If ‘--option restrict-eval true’ is given, the evaluator will throw an exception if an attempt is made to access any file outside of the Nix search path. This is primarily intended for Hydra, where we don't want people doing ‘builtins.readFile ~/.ssh/id_dsa’ or stuff like that.
This commit is contained in:
		
							parent
							
								
									47bdc52c1b
								
							
						
					
					
						commit
						15d2d3c34e
					
				
					 6 changed files with 65 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -614,7 +614,8 @@ void EvalState::addToSearchPath(const string & s, bool warn)
 | 
			
		|||
    path = absPath(path);
 | 
			
		||||
    if (pathExists(path)) {
 | 
			
		||||
        debug(format("adding path ‘%1%’ to the search path") % path);
 | 
			
		||||
        searchPath.push_back(std::pair<string, Path>(prefix, path));
 | 
			
		||||
        /* Resolve symlinks in the path to support restricted mode. */
 | 
			
		||||
        searchPath.push_back(std::pair<string, Path>(prefix, canonPath(path, true)));
 | 
			
		||||
    } else if (warn)
 | 
			
		||||
        printMsg(lvlError, format("warning: Nix search path entry ‘%1%’ does not exist, ignoring") % path);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue