Skip to content

Commit 95b43ad

Browse files
committed
cleanup & check if py is 3.11 or higher
1 parent 69cc69b commit 95b43ad

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

aikido_zen/sinks/sqlite3.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sqlite3 as _sqlite3
2-
2+
import sys
33
from aikido_zen.helpers.get_argument import get_argument
44
from aikido_zen.helpers.modify_arguments import modify_arguments
55
import aikido_zen.vulnerabilities as vulns
@@ -12,15 +12,6 @@
1212
)
1313

1414

15-
@before
16-
def _cursor_execute(func, instance, args, kwargs):
17-
query = get_argument(args, kwargs, 0, "sql")
18-
19-
register_call("sqlite3.Cursor.execute", "sql_op")
20-
vulns.run_vulnerability_scan(
21-
kind="sql_injection", op="sqlite3.Cursor.execute", args=(query, "sqlite")
22-
)
23-
2415

2516
@before
2617
def _execute(func, instance, args, kwargs):
@@ -59,8 +50,8 @@ def _connect(func, instance, args, kwargs):
5950
"cursor": _cursor_patch
6051
}
6152

62-
if _PATCH_CONNECTION_EXECUTE:
63-
# Since py 3.11 there are more ways than using the cursor to execute (e.g. using the connection)
53+
# In Python 3.11, the sqlite3 module was fully moved to C. Hence the extra patches
54+
if sys.version_info >= (3, 11):
6455
connection_patches.update(
6556
{
6657
"execute": _execute,

0 commit comments

Comments
 (0)