Enhance URL handling in ClientRequest for got Options

This commit is contained in:
Napalys
2025-03-21 13:42:14 +01:00
parent b33f760765
commit 99efb610d4
3 changed files with 15 additions and 2 deletions

View File

@@ -436,6 +436,13 @@ module ClientRequest {
override DataFlow::Node getUrl() {
result = this.getArgument(0) and
not exists(this.getOptionArgument(1, "baseUrl"))
or
// Handle URL when passed as options
exists(API::InvokeNode optionsCall |
optionsCall = API::moduleImport("got").getMember("Options").getAnInvocation() and
optionsCall.getReturn().getAValueReachableFromSource() = this.getAnArgument() and
result = optionsCall.getParameter(0).getMember("url").asSink()
)
}
override DataFlow::Node getHost() {