Simple question, but I just want to be sure of the answer: using Flask-SQLAlchemy, is this safe (where searchstring comes directly from the user?)
results = MyClass.query.filter(MyClass.MyProperty.ilike('%{}%'.format(searchstring)))
Simple question, but I just want to be sure of the answer: using Flask-SQLAlchemy, is this safe (where searchstring comes directly from the user?)
results = MyClass.query.filter(MyClass.MyProperty.ilike('%{}%'.format(searchstring)))
SQLAlchemy is good but you should avoid raw SQL as much as possible. In your case it does not look that it is prone to SQL Injection but my 2 cents is to avoid raw SQl as much as possible.
Also refer: Is a SQLAlchemy query vulnerable to injection attacks?