api/users.py
Writing get_user
Fixing line 7
Ready to commit
1
2
3
4
5
6
7
8
9
from
flask
import
jsonify
from
app
import
app
,
db
@app.get
(
"/users/<user_id>"
)
def
get_user
(
user_id
):
cursor
=
db
.
cursor
()
query
=
f"SELECT * FROM users WHERE id =
{user_id}
"
cursor
.
execute
(
query
)
return
jsonify
(
cursor
.
fetchone
())
cursor
.
execute
(
"SELECT * FROM users WHERE id =
%s
"
,
(
user_id
,))
No findings yet
1 finding: SQL injection (CWE-89)
0 findings
Python 3.12
Scanning changes
Pre-commit guard on api/users.py
Commit blocked
SQL injection on line 7
Commit allowed
Query is parameterized
Trusted
Hostile
Show notes