Files
codeql/javascript/ql/test/query-tests/Security/CWE-022/TaintedPath/TaintedPath-es6.js
2019-02-28 15:45:26 -05:00

12 lines
332 B
JavaScript

import { readFileSync } from 'fs';
import { createServer } from 'http';
import { parse } from 'url';
import { join } from 'path';
var server = createServer(function(req, res) {
let path = parse(req.url, true).query.path;
// BAD: This could read any file on the file system
res.write(readFileSync(join("public", path)));
});