-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathPsycopg2.qll
More file actions
45 lines (42 loc) · 1.45 KB
/
Psycopg2.qll
File metadata and controls
45 lines (42 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* Provides classes modeling security-relevant aspects of the `psycopg2` PyPI package.
* See
* - https://www.psycopg.org/docs/
* - https://pypi.org/project/psycopg2/
*/
private import python
private import semmle.python.dataflow.new.DataFlow
private import semmle.python.dataflow.new.RemoteFlowSources
private import semmle.python.Concepts
private import semmle.python.ApiGraphs
private import semmle.python.frameworks.PEP249
/**
* Provides models for the `psycopg2` PyPI package.
* See
* - https://www.psycopg.org/docs/
* - https://pypi.org/project/psycopg2/
*/
private module Psycopg2 {
// ---------------------------------------------------------------------------
// Psycopg
// ---------------------------------------------------------------------------
/**
* A model of psycopg2 as a module that implements PEP 249, providing ways to execute SQL statements
* against a database.
*/
class Psycopg2 extends PEP249::PEP249ModuleApiNode {
Psycopg2() { this = API::moduleImport("psycopg2") }
}
/** A database connection obtained from a psycopg2 connection pool. */
class Psycopg2ConnectionPoolMember extends PEP249::DatabaseConnection {
Psycopg2ConnectionPoolMember() {
this =
any(Psycopg2 p)
.getMember("pool")
.getMember(["SimpleConnectionPool", "ThreadedConnectionPool", "AbstractConnectionPool"])
.getAnInstance()
.getMember("getconn")
.getReturn()
}
}
}