From the security perspective (and not usability as it's discussed here https://stackoverflow.com/questions/3648430/is-it-a-bad-idea-to-escape-html-before-inserting-into-a-database-instead-of-upon), why is it a bad idea to escape HTML before escaping SQL?
-
4I think you may have misread the question and answers. I don't see anything about escaping SQL or SQL injection in there.– XanderMay 23, 2014 at 15:19
-
Have a look at my answer to Preventing code injection without limiting user input?– GumboMay 24, 2014 at 5:46
-
@Gumbo now thinking... what about the semicolon? Escaping HTML will introduce a semicolon (e.g. $quot;), and could not be this used to exploit the DB?– user15194May 25, 2014 at 9:57
-
@yzT It would only appear within string literals, where it wouldn’t be interpreted as statement separator.– GumboMay 25, 2014 at 10:02
Add a comment
|