in reply to Form, Input, Taint related
CGI is the way to go. It's the only way to go. There are some smaller versions that do much of what CGI.pm does, but CGI is just fine in it's full form.
There's a lot to the discussion, but in a nutshell tainting is not really necessary if you are just collecting input and writing it to a database. One assumes that your normal validation of the input, e.g., did they enter a number when they should have entered letter, will protect what goes into the database. In fact, setting the -T switch will have no effect on this kind of input that stays 'inside the system.'
However, it's a must if you are using it to do something that involves file or directory manipulation, shells and the like. That is the only time I have found that the -T switch will scream if you neglect to untaint. Here's a sample untaint:
my $url=~ /(http://www.[\w-.]+)/; my $untainted_url = $1;
Make sure that you really do test the value for what it should be and don't cheat with something ineffectual like:
my $url=~ /([\w-.]+)/; my $untainted_url = $1;
Update: Forgot about Ovid's great little node "Use CGI or die;" comparing CGI to other methods.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Form, Input, Taint related
by jhourcle (Prior) on Apr 11, 2005 at 12:31 UTC | |
by Anonymous Monk on Apr 15, 2005 at 17:49 UTC | |
by merlyn (Sage) on Apr 15, 2005 at 20:48 UTC | |
by jhourcle (Prior) on Apr 15, 2005 at 22:03 UTC |