in reply to Re: How to remember who is logged in...
in thread How to remember who is logged in...

If you use any session manager that uses Data::Dumper like CGI::Session does, then remember that Data::Dumper is not writing out simple data and then reading it back in. Data::Dumper writes out Perl code that is evaluated when you de-serialize your data. That means that if anybody has an opportunity to mess with your data files while they are sitting on the file system then you have a huge potential security risk.

If you use Data::Dumper, be absolutely certain that nobody has write access to the data files that should not. I really don't like to use Data::Dumper for anything in CGI, partly for that reason and partly because it's just slow. You might want to look at using FreezeThaw. It's pure Perl so it doesn't require anything special, but it writes and reads data blocks instead of Perl code.

Replies are listed 'Best First'.
Re: Potential security hazard, be careful
by Aristotle (Chancellor) on Sep 06, 2002 at 04:42 UTC
    This can be avoided using the Safe module. Build the compartment to evaluate the Perl-code configuration using
    $compartment = new Safe; $compartment->permit_only(qw(:base_core :base_mem)); # very restrictiv +e $result = $compartment->reval($unsafe_code);
    and the evaluated code will not be able to do anything than build data structures. (See perldoc Opcode for a list of tags.)

    Makeshifts last the longest.