AidanLee has asked for the wisdom of the Perl Monks concerning the following question:
I've recently decided to start doing The Right Thing for my current project and turn on the Taint switch. I've immediately run into a problem where I'm eval'ing a hash from disk that the program originally spit out using Data::Dumper to achieve caching.
The problem is of course that Taint is complaining about an insecure dependency when run eval on the file contents. My issue is that the data structure in this file is often quite large, and although it does not contain anything particularly dazzling (just scalars, hash and array refs), I was wondering if anyone had a solution for quickly detainting this kind of data without doing so blindly (ie, walk hash (and nested references) and run each scalar through a generic regex).
Some of the contents of this cached file is bound for SQL statements, so it is actually important that the data be "clean." And while the files should be inherently safe (coming from the same program that reads them back in), it is never really save to make such assumptions.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: untainting large stored-to-disk data structures
by merlyn (Sage) on Oct 09, 2001 at 20:20 UTC |