Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by mcherm on Sunday September 04, 2016 @06:33PM
(#12427040)
It is also security policies put together by overly cautious people. They say "I can't trust our developers to write properly secure code, and it won't hurt anyway so I'll just institute a blanket policy to block everything that might appear in an SQL injection attack. Let's see... we'll block quotes, ";", the word "null"... maybe a few more things."
[ Parent
| on HN ]
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by eyelidlessness on Sunday September 04, 2016 @07:08PM
(#12427177)
This is also horrifying, as it indicates that they're taking wildly destructive precautions but still putting user input into SQL queries.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by kedean on Sunday September 04, 2016 @07:22PM
(#12427205)
I don't think the suggestion was that the policy is created because the data is going into sql queries. The policies are often in place because the people in charge of the policy flat out don't trust the developers. Say the policy comes out of the CTO's office, they have two options: 1) liberal password policy, risk a crappy developer screwing up, or 2) conservative policy, not have to worry at night.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by Buttons840 on Sunday September 04, 2016 @08:45PM
(#12427479)
Slight change of topic here. Your comment made me realize that once a system gets too complicated the only change that can be made is to add more complexity.
In this case. It would be better to ensure all SQL is properly escaped, but because that isn't a trivial task, instead you end up adding another layer of complexity.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by flomo on Monday September 05, 2016 @12:07AM
(#12428034)
Right, and in larger organizations, the "they" are two completely different groups of people. My current situation: Developers in City A are expected to use secure coding standards. But the IT group in City B, halfway across the country, installs a intruder-alert proxy which blocks urls which might contain HTML or SQL. The CTO is probably too busy playing golf with Oracle salesfolks to care, everyone is just looking after their own end of the business.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by colejohnson66 on Sunday September 04, 2016 @07:35PM
(#12427245)
I think you're misreading what the parent said. It sounded like that even if prepared queries (like PDO), some developers don't trust the database devs to Do The Right Thing(tm).
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by eyelidlessness on Sunday September 04, 2016 @07:56PM
(#12427314)
If they're using prepared statements, they shouldn't be doing anything about SQL injection attacks, as either the prepared statements work or they don't.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by dagss on Sunday September 04, 2016 @08:13PM
(#12427369)
Exactly -- "if they are". Are they? How can you, as a manager, know? How can you make 100% sure that every developer to ever work on the code always does the right thing?
Then consider the downside and cost of filtering the input, vs. the downside and cost of injection attack times a probability of 0.01% of a developer messing up -- and a policy, however idiotic it may seem to the individual developer, may make sense on a business level.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by dragonwriter on Sunday September 04, 2016 @11:24PM
(#12427894)
A manager can just add easily create a policy about prepared statements as create a policy about mangling text to "protect" user input that is being put into SQL queries. And neither is easier to monitor. Adding the second as an additional policy because of uncertainty about compliance with the first is silly -- it bus you nothing where the first is complied with and gets you another monitoring problem. Better to just expend the same additional effort you'd expend monitoring the second policy to just improve monitoring the first policy.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by dagss on Monday September 05, 2016 @03:12AM
(#12428636)
It seems like you are ready to declare "second line of defense" as a silly thing in principe?
Sometimes adding a second line of defense at 90% efficiency is cheaper than increasing the first line from 90% to 99%.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by eyelidlessness on Sunday September 04, 2016 @08:28PM
(#12427419)
I was responding to the premise. I was not responding to not the premise. Shrug.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by recursive on Sunday September 04, 2016 @11:50PM
(#12427986)
You can use 100% prepared statements, and still be vulnerable to sql injection. Imagine SQL dynamically building SQL. It's real and I've seen it.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers
by DCoder on Monday September 05, 2016 @08:15AM
(#12429737)
We had to integrate a webshop with the customer's existing SAP installation. The consultants in charge of SAP gave us a SOAP webservice that, among other things, had a command called ExecuteSQL - we could pass a raw SQL string and the SAP server would execute it. They "protected" it by blacklisting common naughty words like DROP, ALTER, etc., as well as semicolons and CAST (I don't really know why). When we needed to actually include a semicolon in the query as part of a string literal, I had to work around their filter by replacing the string literal with CONVERT(VARCHAR(MAX), 0x.......) .