blacklisting vs whitelisting in form's input filtering and validation

ultrajohn picture ultrajohn · Aug 24, 2010 · Viewed 21.4k times · Source

which is the preferred approach in sanitizing inputs coming from the user?

thank you!

Answer

Chad picture Chad · Aug 24, 2010

The best approach is to either use stored procedures or parameterized queries. White listing is an additional technique that is ok to prevent any injections before they reach the server, but should not be used as your primary defense. Black listing is usually a bad idea because it's usually impossible to filter out all malicious inputs.

BTW, this answer is considering you mean sanitizing as in preventing sql injection.