File tree Expand file tree Collapse file tree 5 files changed +51
-0
lines changed
test/library-tests/frameworks/psycopg Expand file tree Collapse file tree 5 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ private import semmle.python.frameworks.Oracledb
4848private import semmle.python.frameworks.Pandas
4949private import semmle.python.frameworks.Peewee
5050private import semmle.python.frameworks.Phoenixdb
51+ private import semmle.python.frameworks.Psycopg
5152private import semmle.python.frameworks.Psycopg2
5253private import semmle.python.frameworks.Pycurl
5354private import semmle.python.frameworks.Pydantic
Original file line number Diff line number Diff line change 1+ /**
2+ * Provides classes modeling security-relevant aspects of the `psycopg` PyPI package.
3+ * See
4+ * - https://www.psycopg.org/psycopg3/docs/
5+ * - https://pypi.org/project/psycopg/
6+ */
7+
8+ private import python
9+ private import semmle.python.dataflow.new.DataFlow
10+ private import semmle.python.dataflow.new.RemoteFlowSources
11+ private import semmle.python.Concepts
12+ private import semmle.python.ApiGraphs
13+ private import semmle.python.frameworks.PEP249
14+
15+ /**
16+ * Provides models for the `psycopg` PyPI package.
17+ * See
18+ * - https://www.psycopg.org/psycopg3/docs/
19+ * - https://pypi.org/project/psycopg/
20+ */
21+ private module Psycopg {
22+ // ---------------------------------------------------------------------------
23+ // Psycopg
24+ // ---------------------------------------------------------------------------
25+ /**
26+ * A model of `psycopg` as a module that implements PEP 249, providing ways to execute SQL statements
27+ * against a database.
28+ */
29+ class Psycopg extends PEP249:: PEP249ModuleApiNode {
30+ Psycopg ( ) { this = API:: moduleImport ( "psycopg" ) }
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ testFailures
2+ failures
Original file line number Diff line number Diff line change 1+ import python
2+ import experimental.meta.ConceptsTest
Original file line number Diff line number Diff line change 1+ import psycopg
2+
3+ conn = psycopg .connect (...)
4+ conn .execute ("some sql" , (42 ,)) # $ getSql="some sql"
5+ cursor = conn .cursor ()
6+ cursor .execute ("some sql" , (42 ,)) # $ getSql="some sql"
7+ cursor .executemany ("some sql" , [(42 ,)]) # $ getSql="some sql"
8+
9+ # as in their examples:
10+ with psycopg .connect (...) as conn :
11+ conn .execute ("some sql" , (42 ,)) # $ getSql="some sql"
12+ with conn .cursor () as cursor :
13+ cursor .execute ("some sql" , (42 ,)) # $ getSql="some sql"
14+ cursor .executemany ("some sql" , [(42 ,)]) # $ getSql="some sql"
You can’t perform that action at this time.
0 commit comments