File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 2828import  java .net .URL ;
2929import  java .net .URLClassLoader ;
3030import  java .nio .file .Files ;
31+ import  java .nio .file .attribute .PosixFilePermission ;
3132import  java .util .ArrayList ;
3233import  java .util .Arrays ;
3334import  java .util .Enumeration ;
35+ import  java .util .HashSet ;
3436import  java .util .List ;
37+ import  java .util .Set ;
3538import  java .util .jar .JarEntry ;
3639import  java .util .jar .JarFile ;
3740import  java .util .jar .JarInputStream ;
@@ -303,6 +306,13 @@ public void run(String[] args) throws Throwable {
303306    }
304307    ensureDirectory (workDir );
305308
309+     // Make sure that the workDir is only accessible by the current user. 
310+     Set <PosixFilePermission > perms  = new  HashSet <>();
311+     perms .add (PosixFilePermission .OWNER_READ );
312+     perms .add (PosixFilePermission .OWNER_WRITE );
313+     perms .add (PosixFilePermission .OWNER_EXECUTE );
314+     Files .setPosixFilePermissions (workDir .toPath (), perms );
315+ 
306316    ShutdownHookManager .get ().addShutdownHook (
307317        new  Runnable () {
308318          @ Override 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments