- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
:-)
Admin
Admin
Admin
I recall there's a few exceptions like in doing column = column & ~1 to flip a bit, at least in PostgreSQL. Though it's been a while since I had to work around those, might be fixed by now. But in any case these are relatively uncommon operations and should be handled by something framework-ish anyway IMHO.
Admin
I've read about vulnerabilities with mysql_real_escape_string being bypassed by non-utf8 characters. This may have been addressed in updates to php, but mysql_ functions have been deprecated as well. http://stackoverflow.com/questions/5139127/php-sql-injection-utf8-poc
The current most accepted answer is use PDO with parameterized queries. I have yet to hear of a proof of concept of SQL injection bypassing properly parameterized PDO queries. If anyone know of such a thing, please post a link!
Admin
Admin
Do monkeys eat peanuts, now? I'd figure if you pay peanuts, you get elephants, or perhaps squirrels.
Admin
Cool, i didn't see that coming!! :-)
Admin
For God's sake man, sanitize your inputs... Or alternatively, use parameterized inputs. Always.
Admin
See here: http://stackoverflow.com/questions/12703420/shortcomings-of-mysql-real-escape-string
And no, Akismet, this is a perfectly helpful comment. I mean: FRIST!
Admin
Thank you, couldn't have said it better myself. The FUD's killing me sometimes.
Admin
I know: I was doing a parody of the original developer. Who is too lame to be in this business.
Admin
The problem is that for people who suck at coding, string manipulation is easy, safe and comfortable. That's why they will actually prefer it to simpler solutions like parameter substitution.
In fact, I'd go so far as to say if I've got to interview a candidate, I'm going to ask a number of programming problems and see if they go for string manipulation. People who reach for that tool first don't get objects, don't get abstractions, and are going to fucking suck and I will want to punch them in the throat.
Admin
Not quite:
Started car 67 times.
On attempts 58 through 67, car started correctly.
Car now starts 10 out of 10 times.
On attempt 67, starter was sluggish.
Checked battery levels, found battery voltage low.
Replaced battery. Key bent. Replacement key ordered.
Resolution: fixed.
Admin
This code is .NET, .NET does not have a function "addslashes" in both examples (before and after the "fix") the text is being read from the text property of the textbox control on the page. He should be using a stored procedure with SQL parameters.
Admin
THANK YOU!!!!!!
I hear so much about SQL injection and how stupid people are for not anticipating it, that I, with very little web development experience, am paranoid at the concept of attempting to build a site.
Sure I could do a Google search for how to prevent SQL injection, but how should I trust them? I mean, I've seen people attempt to post answers and then get ridiculed for not thinking of possibility #445.
Without doing any research, my immediate thought is that there is no correct way and everyone's a critic.
Admin
I think that would be the case if it were a co-worker, not a contractor.
Admin
You do realize that you're trying to break into a SQL engine, not a web browser, right?
Admin
Why? Client side hashing along with a session bound random salt provided by the server is an excellent way to ensure security on an untrusted network where sniffing can occur. Certainly you don't want to transmit clear text passwords over the internet. Now of course you could say, "why not just use SSL?" And of course you should, but there is nothing wrong with an additional layer of security.
Admin
For the kind of stuff that I do, I use Sublime Text 2. I think it's better, you might not. It's all very subjective anyways. I for example am not a big fan of PHP, I prefer javascript (node.js) and python, but I wouldn't touch anything Microsoft with a 10 foot pole.