restrict
Nodejs module that blocks applications from using procss.binding('process_wrap'), process.kill and child_process methods.
This protects applications from invoking these methods unintentionally, that could harm the functioning of the framework or application being developed.
This package is tested only with Node versions 8 and 10.
install
With npm do:
npm install restrict
usage
var restrict = require('restrict');
restrict({
'whitelist': ['ls'],
'whitelistPath': ['/bin']
});
restrict.setWhitelist(['grep'], ['/bin', '/usr/bin']);
var child_process = require('child_process');
try {
child_process.exec('/bin/ls', function (err, stdout, stderr) {
console.log(stdout);
});
child_process.spawn('grep', ['ssh']);
} catch (e) {
console.log(e);
}
try {
process.kill(30);
} catch (e) {
console.log(e);
}
Build Status

Node Badge
