pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:
Yous most holy monk types...
I'm working on something that uses tainting and Expect. Expect's logfile feature uses IO::File to open the logfile. If you open the Expect log file with a relative path, IO::File uses File::Spec->rel2abs to convert it to an absolute file name.
My quibble is, if I use a relative path, and I've un-tainted that file name, IO::File will taint it when it converts it to an absolute path. The script dies complaining about the tainted value, but the error doesn't say anything about how it's the conversion from relative to absolute that's causing the tainting.
I consider this a bug in IO::File, and I'd like to make a patch.
Here are my actual questions:
Do you agree that this is a bug?
What's the best way to handle this?
Make it not taint the value somehow? I'd have to untaint the new absolute path. That might not actually be bad, if I check to make sure the relative path is not tainted then the absolute path should be OK by definition, right? Hmmm.. maybe not... I could make a dir with a name like "rm -r /", cd to it and then invoke this thing... Yeah, that would be bad...
Make it die with a more informative error? If I can check to see if taint checking is on, then I could see if the value goes from un-tainted to tainted and issue a warning. That's probably the best choice.
What do you all think?
Thanks!
-Pileofrogs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IO::File tainting quibble
by ikegami (Patriarch) on Sep 07, 2007 at 20:28 UTC | |
by pileofrogs (Priest) on Sep 12, 2007 at 22:22 UTC |