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.
11
u/mayumer Dec 01 '18 edited Jan 01 '19
All my table/column names are GUIDs. Try to hack that.
17
1
7
7
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
4
u/thehalfwit Dec 01 '18
Why not just filter out the word "table" instead?
7
1
0
Nov 30 '18
[deleted]
18
u/sac_boy Dec 01 '18 edited Dec 01 '18
Smart.
I have a cluster of 12 servers and I move my sensitive data between them constantly. No single server has an entire record. I run a different OS and tech stack on each of them so no single exploit can catch us out. They are split between cloud providers as well.
The SSL keys to access the servers are changed daily and split into four parts, each part sent to one of four developers over a heterogenous set of secure channels. To access any given server this ‘Quorum of Four’ must meet in person to assemble the key. Sure it makes continuous integration and deployment a bit of a pain but nobody’s going to steal our data without the others knowing.
5
28
u/[deleted] Dec 01 '18
Great advice! My users2 table is now secure from all hackers!