Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d93afe

Browse files
tausbnRasmusWL
authored andcommitted
Python: Add logging.Logger model
1 parent dea61e1 commit 9d93afe

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

python/ql/lib/semmle/python/frameworks/Stdlib.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,10 @@ module Stdlib {
255255
*/
256256
module Logger {
257257
/** Gets a reference to the `logging.Logger` class or any subclass. */
258-
private API::Node subclassRef() {
258+
API::Node subclassRef() {
259259
result = API::moduleImport("logging").getMember("Logger").getASubclass*()
260+
or
261+
result = ModelOutput::getATypeNode("logging.Logger~Subclass").getASubclass*()
260262
}
261263

262264
/**

python/ql/src/meta/ClassHierarchy/Find.ql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,12 @@ class Urllib3PoolManager extends FindSubclassesSpec {
404404
override API::Node getAlreadyModeledClass() { result = Urllib3::PoolManager::classRef() }
405405
}
406406

407+
class StdlibLogger extends FindSubclassesSpec {
408+
StdlibLogger() { this = "logging.Logger~Subclass" }
409+
410+
override API::Node getAlreadyModeledClass() { result = Stdlib::Logger::subclassRef() }
411+
}
412+
407413
bindingset[fullyQualified]
408414
predicate fullyQualifiedToYamlFormat(string fullyQualified, string type2, string path) {
409415
exists(int firstDot | firstDot = fullyQualified.indexOf(".", 0, 0) |

0 commit comments

Comments
 (0)