jettero has asked for the wisdom of the Perl Monks concerning the following question:
I am looking for a safe way to execute untrusted user regular expressions. If I have to, I'll XS up some gnu or pcre regular support into my application...
But I'm hoping there's a better way.
I briefly considered Safe.pm and running regulars on the regulars to remove things like (?{ system "rm -rvf /" }), but I decided that really wasn't reliable enough since perl gives you so many choices to execute code in your regexps.
Is there a way to do this without XS?
UPDATE: This conversation went a totally different direction than I was really thinking it would. I'm totaly fascinated by the C-stack limits of the pre 5.8.3 regexps. wow, you learn something every day.
UPDATE #2: Well after the fact, I did end up using XS to bring glibc/gnu regex into perl: POSIX::Regex.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: safe untrusted regexp
by diotalevi (Canon) on Aug 16, 2006 at 14:06 UTC | |
by jettero (Monsignor) on Aug 16, 2006 at 15:37 UTC | |
by diotalevi (Canon) on Aug 16, 2006 at 16:08 UTC | |
by jettero (Monsignor) on Aug 16, 2006 at 16:50 UTC | |
by ikegami (Patriarch) on Aug 16, 2006 at 17:27 UTC | |
|
Re: safe untrusted regexp
by ikegami (Patriarch) on Aug 16, 2006 at 14:18 UTC |