I'm accepting a GET query parameter which will be used as piece of a search string.
If I have this:
x = request.args['x']
MyTable.query.filter(MyTable.myCol.ilike(x)).one()
Am I vulnerable to a SQL injection attack?
EDIT - I am using Postgres and SQLAlchemy 1.0 I think.
According to https://stackoverflow.com/a/31949750/3359014,
MyTable.query.filter(MyTable.myCol.ilike(x)).one() is not considered a raw sql and the underlying db-api will escape x.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With