Skip to content

NVR with realtime local object detection for IP cameras

fix: use parameterized query in get_face_ids to prevent SQL injection (#22500)

ryzendigoaea91a91d5b9
diff --git a/frigate/embeddings/__init__.py b/frigate/embeddings/__init__.py
index 0a854fcfad..5e14d0d8c3 100644
--- a/frigate/embeddings/__init__.py
+++ b/frigate/embeddings/__init__.py
@@ -205,14 +205,14 @@ class EmbeddingsContext:
)
def get_face_ids(self, name: str) -> list[str]:
- sql_query = f"""
+ sql_query = """
SELECT
id
FROM vec_descriptions
- WHERE id LIKE '%{name}%'
+ WHERE id LIKE ?
"""
- return self.db.execute_sql(sql_query).fetchall()
+ return self.db.execute_sql(sql_query, (f"%{name}%",)).fetchall()
def reprocess_face(self, face_file: str) -> dict[str, Any]:
return self.requestor.send_data(