From 5feb2a7726ffbb4e1e71bf579426ba0722ffe4f4 Mon Sep 17 00:00:00 2001 From: Taus Date: Tue, 10 Oct 2023 14:48:11 +0000 Subject: [PATCH] Python: extend aiohttp model --- python/ql/lib/semmle/python/frameworks/Aiohttp.qll | 2 ++ python/ql/src/meta/ClassHierarchy/Find.ql | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/python/ql/lib/semmle/python/frameworks/Aiohttp.qll b/python/ql/lib/semmle/python/frameworks/Aiohttp.qll index e7680495929..78d269c31d3 100644 --- a/python/ql/lib/semmle/python/frameworks/Aiohttp.qll +++ b/python/ql/lib/semmle/python/frameworks/Aiohttp.qll @@ -32,6 +32,8 @@ module AiohttpWebModel { /** Gets a reference to the `aiohttp.web.View` class or any subclass. */ API::Node subclassRef() { result = API::moduleImport("aiohttp").getMember("web").getMember("View").getASubclass*() + or + result = ModelOutput::getATypeNode("aiohttp.web.View~Subclass").getASubclass*() } } diff --git a/python/ql/src/meta/ClassHierarchy/Find.ql b/python/ql/src/meta/ClassHierarchy/Find.ql index 4b9ce1fdbb8..0f860452a08 100644 --- a/python/ql/src/meta/ClassHierarchy/Find.ql +++ b/python/ql/src/meta/ClassHierarchy/Find.ql @@ -431,6 +431,12 @@ class AiochClient extends FindSubclassesSpec { override API::Node getAlreadyModeledClass() { result = Aioch::Client::subclassRef() } } +class AiohttpView extends FindSubclassesSpec { + AiohttpView() { this = "aiohttp.web.View~Subclass" } + + override API::Node getAlreadyModeledClass() { result = AiohttpWebModel::View::subclassRef() } +} + bindingset[fullyQualified] predicate fullyQualifiedToYamlFormat(string fullyQualified, string type2, string path) { exists(int firstDot | firstDot = fullyQualified.indexOf(".", 0, 0) |