mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Python: Model aiosqlite
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
private import semmle.python.frameworks.Aioch
|
||||
private import semmle.python.frameworks.Aiohttp
|
||||
private import semmle.python.frameworks.Aiomysql
|
||||
private import semmle.python.frameworks.Aiosqlite
|
||||
private import semmle.python.frameworks.Aiopg
|
||||
private import semmle.python.frameworks.Asyncpg
|
||||
private import semmle.python.frameworks.CassandraDriver
|
||||
|
||||
39
python/ql/lib/semmle/python/frameworks/Aiosqlite.qll
Normal file
39
python/ql/lib/semmle/python/frameworks/Aiosqlite.qll
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Provides classes modeling security-relevant aspects of the `aiosqlite` PyPI package.
|
||||
* See
|
||||
* - https://pypi.org/project/aiosqlite/
|
||||
*/
|
||||
|
||||
private import python
|
||||
private import semmle.python.dataflow.new.DataFlow
|
||||
private import semmle.python.Concepts
|
||||
private import semmle.python.ApiGraphs
|
||||
private import semmle.python.frameworks.PEP249
|
||||
|
||||
/** Provides models for the `aiosqlite` PyPI package. */
|
||||
private module Aiosqlite {
|
||||
/**
|
||||
* A model of `aiosqlite` as a module that implements PEP 249 using asyncio, providing
|
||||
* ways to execute SQL statements against a database.
|
||||
*/
|
||||
class AiosqlitePEP249 extends PEP249::AsyncPEP249ModuleApiNode {
|
||||
AiosqlitePEP249() { this = API::moduleImport("aiosqlite") }
|
||||
}
|
||||
|
||||
/**
|
||||
* An additional cursor, that is return from the coroutine Connection.execute,
|
||||
* see https://aiosqlite.omnilib.dev/en/latest/api.html#aiosqlite.Connection.execute
|
||||
*/
|
||||
class AiosqliteCursor extends PEP249::AsyncDatabaseCursor {
|
||||
AiosqliteCursor() {
|
||||
this =
|
||||
API::moduleImport("aiosqlite")
|
||||
.getMember("connect")
|
||||
.getReturn()
|
||||
.getAwaited()
|
||||
.getMember("execute")
|
||||
.getReturn()
|
||||
.getAwaited()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,9 @@ module PEP249 {
|
||||
result in ["sql", "statement", "operation", "query", "query_string", "sql_script"]
|
||||
}
|
||||
|
||||
private string getExecuteMethodName() { result in ["execute", "executemany", "executescript"] }
|
||||
private string getExecuteMethodName() {
|
||||
result in ["execute", "executemany", "executescript", "execute_insert", "execute_fetchall"]
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to an execute method on a database cursor or a connection, such as `execute`
|
||||
|
||||
Reference in New Issue
Block a user