diff --git a/index.py b/index.py index 83759b9..5a87875 100644 --- a/index.py +++ b/index.py @@ -7,12 +7,11 @@ } 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 + "'" + query = "SELECT * FROM {} WHERE {} = ?".format(CONFIG["default_table"], CONFIG["default_column"]) connection = sqlite3.connect("database.db") cursor = connection.cursor() - cursor.execute(query) + cursor.execute(query, (value,)) result = cursor.fetchall() connection.close()