Skip to content

Commit e291d61

Browse files
Add oracledb model
1 parent c33dd8f commit e291d61

File tree

7 files changed

+41
-1
lines changed

7 files changed

+41
-1
lines changed

docs/codeql/support/reusables/frameworks.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ and the CodeQL library pack ``codeql/python-all`` (`changelog <https://github.co
226226
mysql-connector, Database
227227
MySQL-python, Database
228228
mysqlclient, Database
229+
oracledb, Database
229230
phoenixdb, Database
230231
psycopg2, Database
231232
pyodbc, Database

python/ql/lib/semmle/python/Frameworks.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ private import semmle.python.frameworks.MarkupSafe
3434
private import semmle.python.frameworks.Multidict
3535
private import semmle.python.frameworks.Mysql
3636
private import semmle.python.frameworks.MySQLdb
37+
private import semmle.python.frameworks.Oracledb
3738
private import semmle.python.frameworks.Peewee
3839
private import semmle.python.frameworks.Phoenixdb
3940
private import semmle.python.frameworks.Psycopg2
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Provides classes modeling security-relevant aspects of the `oracledb` PyPI package.
3+
*
4+
* See
5+
* - https://python-oracledb.readthedocs.io/en/latest/index.html
6+
* - https://pypi.org/project/oracledb/
7+
*/
8+
9+
private import python
10+
private import semmle.python.dataflow.new.DataFlow
11+
private import semmle.python.dataflow.new.RemoteFlowSources
12+
private import semmle.python.Concepts
13+
private import semmle.python.ApiGraphs
14+
private import semmle.python.frameworks.PEP249
15+
16+
/**
17+
* Provides models for the `oracledb` PyPI package.
18+
*
19+
* See
20+
* - https://python-oracledb.readthedocs.io/en/latest/index.html
21+
* - https://pypi.org/project/oracledb/
22+
*/
23+
private module Oracledb {
24+
/**
25+
* A model for oracledb as a module that implements PEP 249, providing ways to execute SQL statements
26+
* against a database.
27+
*/
28+
class Oracledb extends PEP249::PEP249ModuleApiNode {
29+
Oracledb() { this = API::moduleImport("oracledb") }
30+
}
31+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
category: minorAnalysis
33
---
4-
* Added model of `cx_Oracle`, `phonenixdb` and `pyodbc` PyPI packages as a SQL interface following PEP249, resulting in additional sinks for `py/sql-injection`.
4+
* Added model of `cx_Oracle`, `oracledb`, `phonenixdb` and `pyodbc` PyPI packages as a SQL interface following PEP249, resulting in additional sinks for `py/sql-injection`.

python/ql/test/library-tests/frameworks/oracledb/ConceptsTest.expected

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import python
2+
import experimental.meta.ConceptsTest
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import oracledb
2+
3+
connection = oracledb.connect(user=u"username", password="password", dsn="connectstring")
4+
cursor = connection.cursor()
5+
cursor.execute("some sql") # $ getSql="some sql"

0 commit comments

Comments
 (0)