diff --git a/python/ql/lib/semmle/python/frameworks/Httpx.qll b/python/ql/lib/semmle/python/frameworks/Httpx.qll index c18da7defb1..189de1dc68e 100644 --- a/python/ql/lib/semmle/python/frameworks/Httpx.qll +++ b/python/ql/lib/semmle/python/frameworks/Httpx.qll @@ -23,11 +23,9 @@ private module HttpxModel { override DataFlow::Node getAUrlPart() { result = this.getArgByName("url") or - not methodName = "request" and - result = this.getArg(0) - or - methodName in ["request", "stream"] and - result = this.getArg(1) + if methodName in ["request", "stream"] + then result = this.getArg(1) + else result = this.getArg(0) } override string getFramework() { result = "httpx" } @@ -66,11 +64,9 @@ private module HttpxModel { override DataFlow::Node getAUrlPart() { result = this.getArgByName("url") or - not methodName = "request" and - result = this.getArg(0) - or - methodName in ["request", "stream"] and - result = this.getArg(1) + if methodName in ["request", "stream"] + then result = this.getArg(1) + else result = this.getArg(0) } override string getFramework() { result = "httpx.[Async]Client" } diff --git a/python/ql/test/library-tests/frameworks/httpx/test.py b/python/ql/test/library-tests/frameworks/httpx/test.py index d9120a1046e..cf519a7ac1a 100644 --- a/python/ql/test/library-tests/frameworks/httpx/test.py +++ b/python/ql/test/library-tests/frameworks/httpx/test.py @@ -5,7 +5,7 @@ httpx.post("url") # $ clientRequestUrlPart="url" httpx.patch("url") # $ clientRequestUrlPart="url" httpx.options("url") # $ clientRequestUrlPart="url" httpx.request("method", url="url") # $ clientRequestUrlPart="url" -httpx.stream("method", url="url") # $ clientRequestUrlPart="url" SPURIOUS: clientRequestUrlPart="method" +httpx.stream("method", url="url") # $ clientRequestUrlPart="url" client = httpx.Client() response = client.get("url") # $ clientRequestUrlPart="url" @@ -13,7 +13,7 @@ response = client.post("url") # $ clientRequestUrlPart="url" response = client.patch("url") # $ clientRequestUrlPart="url" response = client.options("url") # $ clientRequestUrlPart="url" response = client.request("method", url="url") # $ clientRequestUrlPart="url" -response = client.stream("method", url="url") # $ clientRequestUrlPart="url" SPURIOUS: clientRequestUrlPart="method" +response = client.stream("method", url="url") # $ clientRequestUrlPart="url" client = httpx.AsyncClient() response = client.get("url") # $ clientRequestUrlPart="url" @@ -21,4 +21,4 @@ response = client.post("url") # $ clientRequestUrlPart="url" response = client.patch("url") # $ clientRequestUrlPart="url" response = client.options("url") # $ clientRequestUrlPart="url" response = client.request("method", url="url") # $ clientRequestUrlPart="url" -response = client.stream("method", url="url") # $ clientRequestUrlPart="url" SPURIOUS: clientRequestUrlPart="method" +response = client.stream("method", url="url") # $ clientRequestUrlPart="url"