mirror of
https://github.com/pdxlocations/contact.git
synced 2026-08-08 01:42:54 +02:00
Fix sql injection in update_ack_nak
Messages with single quotes would send data directly to sqlite
This commit is contained in:
+6
-5
@@ -53,12 +53,13 @@ def update_ack_nak(channel, timestamp, message, ack):
|
||||
db_cursor = db_connection.cursor()
|
||||
update_query = f"""
|
||||
UPDATE {get_table_name(channel)}
|
||||
SET ack_type = '{ack}'
|
||||
WHERE user_id = {str(globals.myNodeNum)} AND
|
||||
timestamp = {timestamp} AND
|
||||
message_text = '{message}'
|
||||
SET ack_type = ?
|
||||
WHERE user_id = ? AND
|
||||
timestamp = ? AND
|
||||
message_text = ?
|
||||
"""
|
||||
db_cursor.execute(update_query)
|
||||
|
||||
db_cursor.execute(update_query, (ack, str(globals.myNodeNum), timestamp, message))
|
||||
db_connection.commit()
|
||||
|
||||
except sqlite3.Error as e:
|
||||
|
||||
Reference in New Issue
Block a user