Skip to content

Commit

Permalink
Patched /tmp/tmpkc700rot/index.py
Browse files Browse the repository at this point in the history
  • Loading branch information
patched.codes[bot] committed Oct 31, 2024
1 parent 5e38558 commit 0ad3d47
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 predefined CONFIG values and a parameterized query for protection against SQL Injection
query = f"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()

Expand Down

0 comments on commit 0ad3d47

Please sign in to comment.