Blue Team · AppSec
Secure code review
You're the reviewer. Find the vulnerable line in real code, pick the right fix and learn why.
A03:2021 · InjectionPython
Building a SQL query
This endpoint looks a user up by email. Which line is dangerous?
Step 1: click the vulnerable line
Python
1@app.route('/api/user')
2def find_user():
3 email = request.args.get('email', '')
4 cur = db.cursor()
5 cur.execute(f"SELECT id, name FROM users WHERE email = '{email}'")
6 row = cur.fetchone()
7 return jsonify(row or {})
