Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions another_bad_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sqlite3

def get_user_data(username):
conn = sqlite3.connect('users.db')
cursor = conn.cursor()
query = f"SELECT * FROM users WHERE username = '{username}'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CRITICAL] SQL Injection Vulnerability: Directly embedding user input into an SQL query via f-string is highly insecure and can lead to SQL injection attacks.

Suggested change
query = f"SELECT * FROM users WHERE username = '{username}'"
query = "SELECT * FROM users WHERE username = ?"
cursor.execute(query, (username,))

cursor.execute(query)
return cursor.fetchall()

unused_var = 10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MINOR] Unused variable: The variable unused_var is defined but never used. Please remove it or use it appropriately.

Suggested change
unused_var = 10
# unused_var = 10

Loading