rzward has asked for the wisdom of the Perl Monks concerning the following question:
I have a perl script that makes use of eval to evaluate custom expressions passed to the script by an HTML file. It's quite a handy feature.
However, from my reading of eval, I could give a mini program to eval and it would happily run it.
Is there a way to limit the functionality of eval? For example, could I make it so eval would never cause a file to be deleted on the hard disk? Is there such a thing as "safe eval"?
If not, is there a way for me to get a list of functions referenced in a Perl string so I can disallow certain functions from being evaluated or in other words do my own restricting?
Thank you in advance for your help.
Richard
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is there such a thing as safe eval?
by broquaint (Abbot) on May 09, 2003 at 23:11 UTC | |
by rzward (Monk) on May 10, 2003 at 03:29 UTC | |
|
Re: Is there such a thing as safe eval?
by gmpassos (Priest) on May 10, 2003 at 23:11 UTC | |
by bobn (Chaplain) on May 11, 2003 at 18:33 UTC | |
|
Re: Is there such a thing as safe eval?
by nutshell (Beadle) on May 09, 2003 at 23:08 UTC | |
by Ovid (Cardinal) on May 09, 2003 at 23:34 UTC | |
by Your Mother (Archbishop) on May 10, 2003 at 00:46 UTC | |
by rzward (Monk) on May 09, 2003 at 23:17 UTC |