Skip to content

Conversation

@nxvl
Copy link
Owner

@nxvl nxvl commented Aug 3, 2019

Fix part 2

In order to fix the SQL injetion once and for all, we should rely on prepared statements, and let the DB engine do the param sanitization, like this:

        sql = "INSERT INTO listings (title, description) VALUES (%s, %s)"
        cur.execute(sql, (title, description))

Now both our unit test and bandit are happy!

@nxvl nxvl changed the title 2.2 sql injection/fix Chapter 2.3: SQL Injection - fix Aug 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants