Skip to content

Commit 38e3346

Browse files
committed
fix: parameterize SQL queries in the db layer
1 parent 0f815a2 commit 38e3346

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

spiderfoot/db.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,8 +1536,8 @@ def scanElementSourcesDirect(self, instanceId: str, elementIdList: list) -> list
15361536
tbl_event_types st \
15371537
WHERE c.scan_instance_id = ? AND c.source_event_hash = s.hash AND \
15381538
s.scan_instance_id = c.scan_instance_id AND st.event = s.type AND \
1539-
t.event = c.type AND c.hash in ('%s')" % "','".join(hashIds)
1540-
qvars = [instanceId]
1539+
t.event = c.type AND c.hash in (%s)" % ",".join("?" * len(hashIds))
1540+
qvars = [instanceId] + hashIds
15411541

15421542
with self.dbhLock:
15431543
try:
@@ -1585,8 +1585,8 @@ def scanElementChildrenDirect(self, instanceId: str, elementIdList: list) -> lis
15851585
FROM tbl_scan_results c, tbl_scan_results s, tbl_event_types t \
15861586
WHERE c.scan_instance_id = ? AND c.source_event_hash = s.hash AND \
15871587
s.scan_instance_id = c.scan_instance_id AND \
1588-
t.event = c.type AND s.hash in ('%s')" % "','".join(hashIds)
1589-
qvars = [instanceId]
1588+
t.event = c.type AND s.hash in (%s)" % ",".join("?" * len(hashIds))
1589+
qvars = [instanceId] + hashIds
15901590

15911591
with self.dbhLock:
15921592
try:

0 commit comments

Comments
 (0)