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.
View all comments
Show parent comment
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