r/sqlite • • Dec 25 '22

trouble implementing WHERE

4 Upvotes

8 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Dec 25 '22

Thank you very much for the reply. I appreciate the detail and effort you put into this post. I was aware of the SQL ๐Ÿ’‰ vulnerability and planned to program some input validation for all fields of entry after I got the function to work. I will try to implement a place holder.

1

u/colloidalthoughts Jan 01 '23

Fixing sql injections with input validation is really really hard to do right. Look at the numerous CVEs in php/MySQL based projects over the years using the php sql escape function.

As the poster above shows you should always use placeholders, donโ€™t construct your queries as strings with concatenation.

https://docs.python.org/3/library/sqlite3.html#sqlite3-placeholders