I am trying to build a service to execute programs in different languages in node and give the output. So far I'm using the child_process's spawn for spawning commands.
let p = spawn('python',[sourceFilePath]);
Is there a way so that I can limit the access of this child_process to my system so it can't access network,file system,etc ?
if it's Unix you can provide uid, gid of user/group with lower permissions:
var child = spawn(process, args, {
detached: true,
uid: uid,
gid: gid,
cwd: appDir,
stdio: [ 'ignore', 'pipe', 'pipe']
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With