mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
model serve-handler in js/exposure-of-private-files
This commit is contained in:
@@ -126,8 +126,27 @@ DataFlow::CallNode servesAPrivateFolder(string description) {
|
||||
result.getArgument(0) = getAPrivateFolderPath(description)
|
||||
}
|
||||
|
||||
from Express::RouteSetup setup, string path
|
||||
/**
|
||||
* Gets an [`express`](https://npmjs.com/package/express) route-setup
|
||||
* that exposes a private folder described by `path`.
|
||||
*/
|
||||
Express::RouteSetup getAnExposingExpressSetup(string path) {
|
||||
result.isUseCall() and
|
||||
result.getArgument([0 .. 1]) = servesAPrivateFolder(path).getEnclosingExpr()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a call to [`serve-handler`](https://npmjs.com/package/serve-handler)
|
||||
* that exposes a private folder described by `path`.
|
||||
*/
|
||||
DataFlow::CallNode getAnExposingServeSetup(string path) {
|
||||
result = DataFlow::moduleImport("serve-handler").getACall() and
|
||||
result.getOptionArgument(2, "public") = getAPrivateFolderPath(path)
|
||||
}
|
||||
|
||||
from DataFlow::Node node, string path
|
||||
where
|
||||
setup.isUseCall() and
|
||||
setup.getArgument([0 .. 1]) = servesAPrivateFolder(path).getEnclosingExpr()
|
||||
select setup, "Serves " + path + ", which can contain private information."
|
||||
node = getAnExposingExpressSetup(path).flow()
|
||||
or
|
||||
node = getAnExposingServeSetup(path)
|
||||
select node, "Serves " + path + ", which can contain private information."
|
||||
|
||||
Reference in New Issue
Block a user