Being new to Node.js, I have this question..
I see it mentioned in a few places that node should not be run as root, such as this. I am just using node to set up a simple web service and executing a python script which requires root access. I just don't understand where the danger lies, as in what could the hacker do.
My node.js file is something like this:-
var http = require('http');
var express = require('express');
var app = express();
app.use(express['static'](__dirname));
app.get('/alert', function(req, res) {
var addr = req.query.addr;
//~ need to check if it is a valid address??
console.log('Received addr -' + addr);
var spawn = require('child_process').spawn;
var process = spawn('python', ['custom-text-led/custom-text.py', addr]);
process.stdout.on('data', function(data) {
console.log('Data:' + data);
});
})
app.get('*', function(req, res) {
res.status(404).send('Unrecognized API call');
});
app.use(function(err, req, res, next) {
if (req.xhr) {
res.status(500).send('Opps, something went wrong');
} else {
next(err);
}
});
app.listen(3000);
console.log('App server running at port 3000');