in reply to Re: use re 'taint' with s/// operator
in thread use re 'taint' with s/// operator
The idea of use 're' 'taint';, is to allow you to break up a tainted string into smaller pieces that will subsequently require being untainted separately. It allows the process of validation to be done safely in separate chunks.Really? In Perl land, there isn't such a thing as "untainting". Short of some XS code removing the flag, once a value is tainted, it remains tainted. "Untainting" variables just means assigning an untainted value to it.
use re 'taint'; just makes sure that regexp derived values ($1, etc) are tainted as well.
It doesn't make much sense to replace bits of a tainted string with other bits and continue to consider it tainted.I think it makes a lot of sense. If I replace bits of a tainted string, there are still bits that are tainted. Why shouldn't it still be tainted? After all, if I replace part of a tainted string with with substr, the result is still tainted.
Note that if one does
the taintedness of $var does not change, regardless whether use re 'taint'; is in effect or not. And so it should.$var =~ s/(.*)/$1/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: use re 'taint' with s/// operator
by BrowserUk (Patriarch) on Nov 19, 2010 at 17:02 UTC | |
by JavaFan (Canon) on Nov 19, 2010 at 19:08 UTC | |
by BrowserUk (Patriarch) on Nov 19, 2010 at 19:20 UTC | |
by JavaFan (Canon) on Nov 19, 2010 at 21:29 UTC | |
by BrowserUk (Patriarch) on Nov 19, 2010 at 21:43 UTC | |
|