mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JS: refactor DefaultUrlRequest: extract the got library
This commit is contained in:
@@ -67,17 +67,6 @@ private class DefaultUrlRequest extends CustomUrlRequest {
|
||||
callee = DataFlow::moduleMember(moduleName, httpMethodName()) and
|
||||
url = getArgument(0)
|
||||
)
|
||||
or
|
||||
(
|
||||
moduleName = "got" and
|
||||
(
|
||||
callee = DataFlow::moduleImport(moduleName) or
|
||||
callee = DataFlow::moduleMember(moduleName, "stream")
|
||||
) and
|
||||
(
|
||||
url = getArgument(0) and not exists (getOptionArgument(1, "baseUrl"))
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -203,3 +192,29 @@ private class NodeHttpUrlRequest extends CustomUrlRequest {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A model of a URL request in the `got` library.
|
||||
*/
|
||||
private class GotUrlRequest extends CustomUrlRequest {
|
||||
|
||||
DataFlow::Node url;
|
||||
|
||||
GotUrlRequest() {
|
||||
exists (string moduleName, DataFlow::SourceNode callee |
|
||||
this = callee.getACall() |
|
||||
moduleName = "got" and
|
||||
(
|
||||
callee = DataFlow::moduleImport(moduleName) or
|
||||
callee = DataFlow::moduleMember(moduleName, "stream")
|
||||
) and
|
||||
url = getArgument(0) and not exists (getOptionArgument(1, "baseUrl"))
|
||||
)
|
||||
}
|
||||
|
||||
override DataFlow::Node getUrl() {
|
||||
result = url
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user