r/shittyprogramming • u/knflrpn • Nov 30 '18
Unbeatable protection from SQL injection.
Just don't name your table "users" so when they do the "DROP TABLE users;" it doesn't work.
143
Upvotes
r/shittyprogramming • u/knflrpn • Nov 30 '18
Just don't name your table "users" so when they do the "DROP TABLE users;" it doesn't work.
28
u/[deleted] Dec 01 '18
Great advice! My users2 table is now secure from all hackers!
11
u/mayumer Dec 01 '18 edited Jan 01 '19
All my table/column names are GUIDs. Try to hack that.
7
u/[deleted] Nov 30 '18
perffect
7
u/[deleted] Dec 01 '18
I quit using SQL and just read and write to one giant flat file.
5
u/walterbanana Dec 01 '18
Great, time to create some pull request for some big open source software then.
4
u/FragileStudios Dec 01 '18
A better idea would be to only use double quotes e.g " " instead of ' ' in your SQL queries. No hacker would ever try double quotes
3
u/PM_ME_YOUR_HIGHFIVE Dec 04 '18
thanks, I added a password to my table names
4
u/thehalfwit Dec 01 '18
Why not just filter out the word "table" instead?
0
u/[deleted] Nov 30 '18
[deleted] — view deleted comment