model serve-handler in js/exposure-of-private-files

This commit is contained in:
Erik Krogh Kristensen
2021-06-06 23:50:35 +02:00
parent e276e2684e
commit 1ad08677c2
4 changed files with 38 additions and 5 deletions

View File

@@ -19,4 +19,5 @@
| private-file-exposure.js:42:1:42:66 | app.use ... dir())) | Serves the home folder, which can contain private information. |
| private-file-exposure.js:43:1:43:46 | app.use ... )("/")) | Serves the root folder, which can contain private information. |
| private-file-exposure.js:51:5:51:88 | app.use ... les'))) | Serves the folder "../node_modules", which can contain private information. |
| private-file-exposure.js:70:5:70:71 | serveHa ... ular"}) | Serves the folder "./node_modules/angular", which can contain private information. |
| subfolder/private-file-exposure-2.js:6:1:6:34 | app.use ... rname)) | Serves the folder query-tests/Security/CWE-200/subfolder, which can contain private information. |

View File

@@ -61,4 +61,13 @@ function good() {
app.use("bootstrap", express.static('./node_modules/bootstrap/dist')); // OK
}
app.use(express.static(__dirname)) // NOT OK
app.use(express.static(__dirname)) // NOT OK
const serveHandler = require("serve-handler");
const http = require("http");
http.createServer((request, response) => {
serveHandler(request, response, {public: "./node_modules/angular"}); // NOT OK
serveHandler(request, response); // OK
}).listen(8080);