News for hackers. Stuff that matters.
Re:Hardcoded secrets, unverified tokens, and other common JW... by XMPPwocky on Saturday June 27, 2020 @02:48PM (#23663777)
"don't concatenate input strings into SQL strings" is a pretty good comparison, because the rise of ORMs and APIs that make parameterized queries ergonomic has done probably 10 times as much to stop SQLi in practice as telling developers to sanitize their inputs ever did.
Re:Hardcoded secrets, unverified tokens, and other common JW... by tester756 on Saturday June 27, 2020 @04:43PM (#23664528)
>sanitize their inputs ever did.

was even escaping input viable strategy?

if you escape thing, then your data in db is broken

parametrization seems like the only strategy out of those 2

Re:Hardcoded secrets, unverified tokens, and other common JW... by corty on Saturday June 27, 2020 @04:57PM (#23664636)
some parts of a query cannot be parameterized, e.g. the column name for an 'order by' in many cases. So you have to do some kind of escaping, sanitation and concatenation.
Re:Hardcoded secrets, unverified tokens, and other common JW... by namibj on Sunday June 28, 2020 @03:26AM (#23667243)
If you're escaping/sanitizing to massage an input string until you can concatenate it into a SQL query, you're doing it wrong. Please don't.
Re:Hardcoded secrets, unverified tokens, and other common JW... by tester756 on Saturday June 27, 2020 @07:51PM (#23665653)
While this solution isn't sexy, cannot it be just simple switch?

switch(int)

case 1: age

case 2: salary

Re:Hardcoded secrets, unverified tokens, and other common JW... by corty on Sunday June 28, 2020 @03:32AM (#23667270)
Yes, unless the database has custom column names e.g. to add your own properties to some object. But that kind of schema is madness in other aspects as well...
Re:Hardcoded secrets, unverified tokens, and other common JW... by namibj on Sunday June 28, 2020 @03:25AM (#23667240)
I have yet to dream up/see a case where you can't puzzle literals together based on user-query parsing until you get your SQL query assembled.
Re:Hardcoded secrets, unverified tokens, and other common JW... by afandian on Saturday June 27, 2020 @04:17PM (#23664337)
Agreed. But writing your own authentication frameworks are a virtually identical situation.