add dataflow barrier for if(xrandr)

This commit is contained in:
Erik Krogh Kristensen
2020-02-06 12:53:12 +01:00
parent aa8ebf4fe1
commit 1f7dda7fbc
3 changed files with 39 additions and 11 deletions

View File

@@ -114,3 +114,27 @@ var server = http.createServer(function(req, res) {
);
});
var server = http.createServer(function(req, res) {
let path = url.parse(req.url, true).query.path;
if (path) { // sanitization
path = path.replace(/[\]\[*,;'"`<>\\?\/]/g, ''); // remove all invalid characters from states plus slashes
path = path.replace(/\.\./g, ''); // remove all ".."
}
res.write(fs.readFileSync(path)); // OK. Is sanitized above.
});
var server = http.createServer(function(req, res) {
let path = url.parse(req.url, true).query.path;
if (!path) {
} else { // sanitization
path = path.replace(/[\]\[*,;'"`<>\\?\/]/g, ''); // remove all invalid characters from states plus slashes
path = path.replace(/\.\./g, ''); // remove all ".."
}
res.write(fs.readFileSync(path)); // OK. Is sanitized above.
});