|
|||||||||||
|
Re: Input validation
From: Jeremiah Grossman <jeremiah(at)whitehatsec.com>
Date: Thu Jun 19 2003 - 22:37:48 EDT
On Thu, 2003-06-19 at 10:38, Kooper, Larry wrote:
I personally like #3. Sometimes proper sanity checking can be difficult to implement in some cases... but maybe less difficult as an alternative to massaging data back into conformity as suggest by #1. I personally find the hardest part not the code itself, but remembering to do the sanity checking on all input and not becoming lazy in the process. The 3 main things I do when sanity checking input that keeps things safe are... Character-Set Check, Length Check, and Escape all input. Making sure I only get the characters I expect, in the max/min length I expect it, and always escape all data. Anything else, I kick an error, and never echo user supplied input. About the # and - characters, escaping should solve the problem or simply just allowing a few more characters in your set. Just watch those meta characters. for your apt. question, my regex skills on display: /^([\d#\-]{1,5})$/ regards, Jer- Received on Thu Jun 19 22:45:39 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:07:52 EDT |
||||||||||
|
|||||||||||