Missions / The AI wrote this
Mission 5 of 6
The AI wrote this
An AI assistant wrote this to look up a user by email. It works, and it is dangerous.
query = "SELECT * FROM users WHERE email = '" + email + "'"
db.execute(query)
The lesson: Always pass user input as a parameter, for example db.execute("SELECT * FROM users WHERE email = %s", (email,)). Check AI-written code like any other code.