mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
JS: refactor DefaultUrlRequest: extract the http library
This commit is contained in:
@@ -68,12 +68,6 @@ private class DefaultUrlRequest extends CustomUrlRequest {
|
||||
url = getArgument(0)
|
||||
)
|
||||
or
|
||||
(
|
||||
(moduleName = "http" or moduleName = "https") and
|
||||
callee = DataFlow::moduleMember(moduleName, httpMethodName()) and
|
||||
url = getArgument(0)
|
||||
)
|
||||
or
|
||||
(
|
||||
moduleName = "got" and
|
||||
(
|
||||
@@ -186,3 +180,26 @@ private class FetchUrlRequest extends CustomUrlRequest {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A model of a URL request in the Node.js `http` library.
|
||||
*/
|
||||
private class NodeHttpUrlRequest extends CustomUrlRequest {
|
||||
|
||||
DataFlow::Node url;
|
||||
|
||||
NodeHttpUrlRequest() {
|
||||
exists (string moduleName, DataFlow::SourceNode callee |
|
||||
this = callee.getACall() |
|
||||
(moduleName = "http" or moduleName = "https") and
|
||||
callee = DataFlow::moduleMember(moduleName, httpMethodName()) and
|
||||
url = getArgument(0)
|
||||
)
|
||||
}
|
||||
|
||||
override DataFlow::Node getUrl() {
|
||||
result = url
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user