mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
factor fetch import into NodeJSLib
This commit is contained in:
@@ -267,17 +267,7 @@ module ClientRequest {
|
||||
DataFlow::Node url;
|
||||
|
||||
FetchUrlRequest() {
|
||||
exists(string moduleName, DataFlow::SourceNode callee | this = callee.getACall() |
|
||||
(
|
||||
moduleName = "node-fetch" or
|
||||
moduleName = "cross-fetch" or
|
||||
moduleName = "isomorphic-fetch"
|
||||
) and
|
||||
callee = DataFlow::moduleImport(moduleName) and
|
||||
url = getArgument(0)
|
||||
)
|
||||
or
|
||||
this = DataFlow::globalVarRef("fetch").getACall() and
|
||||
this = NodeJSLib::Fetch::moduleImport() and
|
||||
url = getArgument(0)
|
||||
}
|
||||
|
||||
|
||||
@@ -1134,4 +1134,18 @@ module NodeJSLib {
|
||||
result = moduleImport().getAPropertyRead(member)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides predicates for working with the "node-fetch" module and its platform-specific instances as a single module.
|
||||
*/
|
||||
module Fetch {
|
||||
/**
|
||||
* Gets a node that imports the "node-fetch" module, or one of its platform-specific instances.
|
||||
*/
|
||||
DataFlow::SourceNode moduleImport() {
|
||||
result = DataFlow::moduleImport(["node-fetch", "cross-fetch", "isomorphic-fetch"])
|
||||
or
|
||||
result = DataFlow::globalVarRef("fetch")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user