This is not a sound assumption. SQL injection is still pretty common in practice. Even frameworks that try to sanitize input may have a "roll your own" approach that has flaws in it.
This is not a sound assumption. SQL injection is still pretty common in practice. Even frameworks that try to sanitize input may have a "roll your own" approach that has flaws in it.
Afaict the only reason this idea ever became widespread was because PHP's native MySQL driver lacked support for it for ages (I guess till PHP5? Been years since I looked into this)
[1] Obviously I'm not talking about validation eg validating a phone number; anytime you're trying to embed strings within a program but have to be worry that your string doesn't get read as part of the program, something has gone horribly wrong
Ofc if the user is putting in full custom queries, parameterization doesn't help anything, but I'm not sure what you're even sanitizing at that point (semantics? Afaik sanitization refers to syntax cleanup; It'd be even dumber to avoid people dropping your important tables by parsing a SQL string, instead of making use of the much more reliable DB permission systems...)
It's absurd: A constant source of vulnerability in websites across the world is a syntax error.
It's the definition of accidental complexity -- A program with a valid semantic understanding of what it has is somehow totally incapable of passing on that wisdom except by code generation; and this is when it is free of the burden of any real constraints beyond correctness -- its certainly not a fast method of serializing/deserializing, it certainly doesn't minimize network-size, it certainly isn't a safe or composable API... it's just a dumb, horrible thing and we pretend its all ok because you just need to sanitize your input.
I wouldn't really care if sanitization was just considered a necessary hack, especially in certain corner-cases; but its not. It's thought of as a good thing to do. In fact, a best practice.
SQL sanitization should never have been recommended to anyone else with a straight face (tears would be appropriate, for the sorry state of the world)
that it became normalized to the extent of becoming a happily provided best practice is horrific
But I doubt anyone even took notice when support properly landed, content in their ways of string-building and worrying about " replaced with \";
Here's a decent example of doing it right:
https://stackoverflow.com/questions/14767530/php-using-pdo-w...
Here's one showing noobs how to do it wrong:
http://pdo.w3clan.com/tutorial/176/like-clause-in-clause-and...
Look at that blind implode function. Argh. It's the danger of copy/paste echo-chambers.