mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-21 23:58:22 +03:00
fix: use parameterized query in get_face_ids to prevent SQL injection
The name parameter was interpolated directly into the SQL query via f-string, allowing SQL injection through crafted face name values. Use a parameterized query with ? placeholder instead.
This commit is contained in:
parent
722ef6a1fe
commit
3a4479397c
@ -205,14 +205,14 @@ class EmbeddingsContext:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_face_ids(self, name: str) -> list[str]:
|
def get_face_ids(self, name: str) -> list[str]:
|
||||||
sql_query = f"""
|
sql_query = """
|
||||||
SELECT
|
SELECT
|
||||||
id
|
id
|
||||||
FROM vec_descriptions
|
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]:
|
def reprocess_face(self, face_file: str) -> dict[str, Any]:
|
||||||
return self.requestor.send_data(
|
return self.requestor.send_data(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user