зеркало из https://github.com/github/codeql.git
JS: Avoid bad join order in ImplicitProcessImport
This commit is contained in:
Родитель
c869812563
Коммит
6a63f5b677
|
@ -7,17 +7,28 @@ import semmle.javascript.frameworks.HTTP
|
|||
import semmle.javascript.security.SensitiveActions
|
||||
|
||||
module NodeJSLib {
|
||||
private GlobalVariable processVariable() {
|
||||
variables(result, "process", any(GlobalScope sc))
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private GlobalVarAccess processExprInTopLevel(TopLevel tl) {
|
||||
result = processVariable().getAnAccess() and
|
||||
tl = result.getTopLevel()
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
private GlobalVarAccess processExprInNodeModule() {
|
||||
result = processExprInTopLevel(any(NodeModule m))
|
||||
}
|
||||
|
||||
/**
|
||||
* An access to the global `process` variable in a Node.js module, interpreted as
|
||||
* an import of the `process` module.
|
||||
*/
|
||||
private class ImplicitProcessImport extends DataFlow::ModuleImportNode::Range {
|
||||
ImplicitProcessImport() {
|
||||
exists(GlobalVariable process |
|
||||
process.getName() = "process" and
|
||||
this = DataFlow::exprNode(process.getAnAccess())
|
||||
) and
|
||||
getTopLevel() instanceof NodeModule
|
||||
this = DataFlow::exprNode(processExprInNodeModule())
|
||||
}
|
||||
|
||||
override string getPath() { result = "process" }
|
||||
|
|
Загрузка…
Ссылка в новой задаче