We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e38558 commit 7311979Copy full SHA for 7311979
index.py
@@ -7,12 +7,12 @@
7
}
8
9
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 + "'"
+ # Use parameterized query to prevent SQL injection
+ query = "SELECT * FROM " + CONFIG["default_table"] + " WHERE " + CONFIG["default_column"] + " = ?"
12
13
connection = sqlite3.connect("database.db")
14
cursor = connection.cursor()
15
- cursor.execute(query)
+ cursor.execute(query, (value,))
16
result = cursor.fetchall()
17
connection.close()
18
0 commit comments