JS: model path.parse and its ponyfill package: "path-parse"

This commit is contained in:
Esben Sparre Andreasen
2020-01-30 21:12:06 +01:00
parent 5b5f52979d
commit 5f1317fa2d
3 changed files with 44 additions and 0 deletions

View File

@@ -401,4 +401,33 @@ private module ClosureLibraryUri {
succ = uri
}
}
/**
* Provides classes for working with [path](https://nodejs.org/api/path.html) code.
*/
module path {
/**
* A taint step in the path module.
*/
private class Step extends UriLibraryStep, DataFlow::CallNode {
DataFlow::Node src;
Step() {
exists(DataFlow::SourceNode ref |
ref = NodeJSLib::Path::moduleMember("parse") or
// a ponyfill: https://www.npmjs.com/package/path-parse
ref = DataFlow::moduleImport("path-parse") or
ref = DataFlow::moduleMember("path-parse", "posix") or
ref = DataFlow::moduleMember("path-parse", "win32")
|
this = ref.getACall() and
src = getAnArgument()
)
}
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
pred = src and succ = this
}
}
}
}