News for hackers. Stuff that matters.
Re:How not to protect against SQL injection (view source) by tptacek on Tuesday March 29, 2011 @04:21PM (#2384241)
This is the second time in a few days someone has made the point that web stacks make it hard to use prepared statements†. This is a one-liner in Rails. Does it not work in Python? How hard is it in PHP?

† Which are not a cure-all for SQLI.

Re:How not to protect against SQL injection (view source) by T-hawk on Tuesday March 29, 2011 @04:48PM (#2384392)
I think the problem angle is slightly different: it's too easy to use simple string concatenation for SQL. That works across pretty much every web stack, so it's the path of least resistance to get something working, and many a developer never bothers to learn the proper idiom anew for every framework.

Side note: We're jumping to conclusions by thinking that the javascript is the entire implementation. It's perfectly possible that the server is already safe against SQL injection and the javascript is just an extra line of defense. Maybe the client and server were done by separate programmers and the client programmer wanted to make sure he wouldn't get blamed. It's a government website: nobody in government ever got fired for being too careful. Or maybe the programmer had to do it to satisfy some non-technical bureaucrat who wanted to think that hacking attempts couldn't even reach his server.

Re:How not to protect against SQL injection (view source) by timwiseman on Tuesday March 29, 2011 @05:30PM (#2384586)
I wrote fairly recently about SQL Injection in Python at http://www.simple-talk.com/sql/learn-sql-server/sql-injectio... .

I do not address web stacks directly there, but Python itself will happily let you use prepared statements, it is up to the programmer to take effective steps to prevent SQL Injection.

Re:How not to protect against SQL injection (view source) by cosmok on Tuesday March 29, 2011 @08:06PM (#2385126)
Re:How not to protect against SQL injection (view source) by damncabbage on Wednesday March 30, 2011 @01:13AM (#2385923)
Except when the database drivers PDO relies on aren't set up by default:

http://news.ycombinator.com/item?id=2376873