Skip to content

Commit

Permalink
The stub code used eval("...") to read in the data structure in the DATA
Browse files Browse the repository at this point in the history
section, which is unsafe, as someone could slip in executable code. Replaced
by Safe::reval.
  • Loading branch information
mschilli committed Apr 26, 2011
1 parent 1f59cee commit aacf766
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/pogo-worker-stub
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use constant LOCKFILE => '/tmp/pogo_worker.lock';
use constant POST_HOOKDIR => '/etc/pogo/post.d/';
use constant PRE_HOOKDIR => '/etc/pogo/pre.d/';
use constant TEMPDIR => '/tmp';
use Safe;

$SIG{HUP} = $SIG{INT} = $SIG{TERM} = $SIG{__DIE__} = \&cleanup;

Expand Down Expand Up @@ -49,7 +50,9 @@ sub run_hooks {

sub main {
print "\n";
$opts = eval(<DATA>);
my $compartment = Safe->new();
$opts = $compartment->reval(<DATA>);
die "safe eval failed: $@" if $@;
die "bad options\n"
unless $opts->{job}
&& $opts->{command}
Expand Down

0 comments on commit aacf766

Please sign in to comment.