How to set file permissions for external proccess

58
January 11, 2019, at 10:10 AM

I run python from java:

String cmd = "python3";
String code = "<Some python code, that can access fs>";
ProcessBuilder pb = new ProcessBuilder(cmd)
        .directory(new File("<Permitted directory>"));
Process p = pb.start();
PrintStream ps = new PrintStream(p.getOutputStream());
ps.println(code);
ps.close();
p.waitFor();

My problem, that python code can write to file system, so it can corrupt it. Python process should have permission to specific directory only - working directory.

How to achieve that?

Note that from java I can call multiple python processes in different directories, so every python process should be permitted for own directory.

READ ALSO
How to lazy fetch only parts of the children entity from the parent entity?

How to lazy fetch only parts of the children entity from the parent entity?

I have a class Department that has a child entity Student(Many to one relationship as a Department can have many students List<Student>

31
How to call a method that has a JPanel over multiple instances in Java [on hold]

How to call a method that has a JPanel over multiple instances in Java [on hold]

I'm trying to make multiple objects with of a class (the Tic class), each with its own JPanel with buttons and stuffRight now when I make instances of the class they all add their buttons to the same JFrame

55
How to turn arg or string into User?

How to turn arg or string into User?

I am making a command and I need to get a list of roles for a user, the problem is that an argument is a string and getMember() expects a UserHow do I turn a string into a User or is there just a better way?

38
PDFBox: do PDDocument and PDPage have references to one another?

PDFBox: do PDDocument and PDPage have references to one another?

Does a PDPage object contains a reference to the PDDocument to which it belongs? In other words, does a PDPage has knowledge of its PDDocument? Somewhere in the application I have a list of PDDocumentsThese documents get merged into one new PDDocument:

41