I'm writing an application where the user can provide a custom javascript function to filter a file on the server side using nashorn/jjs:
cat /etc/js/library.js user.js > tmp.js &&
cat /path/to/input.txt | jjs --language=es6 -doe -J-Djava.security.manager tmp.js > /path/to/output.txt &&
rm tmp.js
I know that the user could write an infinite loop to fill my disk:
for(;;) print("#####);
But is -J-Djava.security.manager
sufficient to prevent him to read/write a file on the filesystem ?
Thanks.