Skip to content

Commit 7311979

Browse files
author
patched.codes[bot]
committed
Patched /tmp/tmpo2vs6pvn/index.py
1 parent 5e38558 commit 7311979

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

index.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
}
88

99
def get_data_by_config_value(value):
10-
# This might look suspicious due to string concatenation with values from CONFIG.
11-
query = "SELECT * FROM " + CONFIG["default_table"] + " WHERE " + CONFIG["default_column"] + " = '" + value + "'"
10+
# Use parameterized query to prevent SQL injection
11+
query = "SELECT * FROM " + CONFIG["default_table"] + " WHERE " + CONFIG["default_column"] + " = ?"
1212

1313
connection = sqlite3.connect("database.db")
1414
cursor = connection.cursor()
15-
cursor.execute(query)
15+
cursor.execute(query, (value,))
1616
result = cursor.fetchall()
1717
connection.close()
1818

0 commit comments

Comments
 (0)