diff --git a/python/ql/lib/semmle/python/frameworks/Httpx.qll b/python/ql/lib/semmle/python/frameworks/Httpx.qll index ec6a446db2e..fee9a840a19 100644 --- a/python/ql/lib/semmle/python/frameworks/Httpx.qll +++ b/python/ql/lib/semmle/python/frameworks/Httpx.qll @@ -9,15 +9,18 @@ private import python private import semmle.python.Concepts private import semmle.python.ApiGraphs +private import semmle.python.frameworks.data.ModelsAsData /** + * INTERNAL: Do not use. + * * Provides models for the `httpx` PyPI package. * * See * - https://pypi.org/project/httpx/ * - https://www.python-httpx.org/ */ -private module HttpxModel { +module HttpxModel { /** * An outgoing HTTP request, from the `httpx` library. * @@ -59,8 +62,10 @@ private module HttpxModel { */ module Client { /** Get a reference to the `httpx.Client` or `httpx.AsyncClient` class. */ - private API::Node classRef() { + API::Node classRef() { result = API::moduleImport("httpx").getMember(["Client", "AsyncClient"]) + or + result = ModelOutput::getATypeNode("httpx.Client~Subclass").getASubclass*() } /** A method call on a Client that sends off a request */ diff --git a/python/ql/src/meta/ClassHierarchy/Find.ql b/python/ql/src/meta/ClassHierarchy/Find.ql index 7b09a521ef8..6244cf1db0e 100644 --- a/python/ql/src/meta/ClassHierarchy/Find.ql +++ b/python/ql/src/meta/ClassHierarchy/Find.ql @@ -18,6 +18,7 @@ private import semmle.python.frameworks.Starlette private import semmle.python.frameworks.ClickhouseDriver private import semmle.python.frameworks.Aiohttp private import semmle.python.frameworks.Fabric +private import semmle.python.frameworks.Httpx import semmle.python.frameworks.data.internal.ApiGraphModelsExtensions as Extensions class FlaskViewClasses extends FindSubclassesSpec { @@ -287,6 +288,12 @@ class FlaskBlueprint extends FindSubclassesSpec { override API::Node getAlreadyModeledClass() { result = Flask::Blueprint::classRef() } } +class HttpxClient extends FindSubclassesSpec { + HttpxClient() { this = "httpx.Client~Subclass" } + + override API::Node getAlreadyModeledClass() { result = HttpxModel::Client::classRef() } +} + bindingset[fullyQualified] predicate fullyQualifiedToYamlFormat(string fullyQualified, string type2, string path) { exists(int firstDot | firstDot = fullyQualified.indexOf(".", 0, 0) |