From d290368f7ccbafaaaa24ccc742e9dd046b5b0e59 Mon Sep 17 00:00:00 2001 From: "patched.codes[bot]" <298395+patched.codes[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:34:10 +0000 Subject: [PATCH] Patched /tmp/tmph8iolfin/index.py --- index.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.py b/index.py index 83759b9..b07f078 100644 --- a/index.py +++ b/index.py @@ -7,12 +7,12 @@ } def get_data_by_config_value(value): - # This might look suspicious due to string concatenation with values from CONFIG. - query = "SELECT * FROM " + CONFIG["default_table"] + " WHERE " + CONFIG["default_column"] + " = '" + value + "'" + # Use parameterized query to prevent SQL injection + query = "SELECT * FROM " + CONFIG["default_table"] + " WHERE " + CONFIG["default_column"] + " = ?" connection = sqlite3.connect("database.db") cursor = connection.cursor() - cursor.execute(query) + cursor.execute(query, (value,)) result = cursor.fetchall() connection.close()