mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
avoid reporting empty names in js/exposure-of-private-files
This commit is contained in:
@@ -80,7 +80,11 @@ Folder getAPackageJSONFolder() { result = any(PackageJSON json).getFile().getPar
|
||||
DataFlow::Node getALeakingFolder(string description) {
|
||||
exists(ModuleScope ms | result.asExpr() = ms.getVariable("__dirname").getAnAccess()) and
|
||||
result.getFile().getParentContainer() = getAPackageJSONFolder() and
|
||||
description = "the folder " + result.getFile().getParentContainer().getRelativePath()
|
||||
(
|
||||
if result.getFile().getParentContainer().getRelativePath().trim() != ""
|
||||
then description = "the folder " + result.getFile().getParentContainer().getRelativePath()
|
||||
else description = "a folder"
|
||||
)
|
||||
or
|
||||
result = DataFlow::moduleImport("os").getAMemberCall("homedir") and
|
||||
description = "the home folder"
|
||||
|
||||
@@ -19,3 +19,4 @@
|
||||
| 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. |
|
||||
| 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. |
|
||||
|
||||
@@ -59,4 +59,6 @@ function good() {
|
||||
|
||||
app.use("jquery", express.static('./node_modules/jquery/dist')); // OK
|
||||
app.use("bootstrap", express.static('./node_modules/bootstrap/dist')); // OK
|
||||
}
|
||||
}
|
||||
|
||||
app.use(express.static(__dirname)) // NOT OK
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,6 @@
|
||||
var express = require('express');
|
||||
var http = require('http')
|
||||
var app = express()
|
||||
var server = http.createServer(app)
|
||||
// Static files:
|
||||
app.use(express.static(__dirname))
|
||||
Reference in New Issue
Block a user