perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: Error with t\api\slurp_filename + t\filter\in_error?
Date Tue, 06 Jul 2004 19:20:26 GMT
On Tue, 6 Jul 2004, Stas Bekman wrote:

> Randy Kobes wrote:
> > On Mon, 5 Jul 2004, Steve Hay wrote:
[ ... ]
> >>but this fails:perl t/TEST -v
> >>t\api\slurp_filename.t t\filter\in_error.t t\filter\in_init_basic.t
> >
> >>The Apache server dies after in_error, so in_init_basic
> >>fails to connect:
> >
> > I think this has something to do with tainting - reducing
> > slurp_filename.pm to (using non-utf8 data, to eliminate
> > one possibility):
[ ... ]
> > then the sequence Steve mentioned for the disconnect
> > occurs, but changing to
> >       my $data = $r->slurp_filename(0);
> > causes no such problem.
>
> So does the worker really crash as Steve has suggested?

Not really a crash (no annoying popup windows appear,
nor is anything in the error log) - the server just goes
away ....

> Can you add something after the eval test above and see
> whether it still gets executed/printed/sent to the client?
>
> Does it have anything to do with the nested eval?
>
>    eval {$received = eval $$data};
>
> Can you use any different approach to cause a taint error
> (e.g. qx[ls $data])  or something? Does the problem
> persist?

I tried this:
=========================================================
package TestAPI::slurp_filename;
[ ... ]
sub handler {
    my $r = shift;
    plan $r, tests => 1;

    {
        eval { system('echo', 'hello') };
#        my ($a, $b) = (1, 0);
#        eval {my $ans = $a / $b};
        ok t_cmp($@, qr/Insecure|Illegal/, "just testing");
    }

    Apache::OK;
}
[ ... ]
=============================================================
and this also led to the server going away (here, the
taint error is an insecure $ENV{PATH}). And, just to
check to see if it was due to the setting of $@ from
eval{}, I commented out the
        eval { system('echo', 'hello') };
and enabled
        #        my ($a, $b) = (1, 0);
        #        eval {my $ans = $a / $b};
but this was OK. So the problem seems specific to a
taint check.

One other tidbit - if in t/filter/TestFilter/in_error.pm,
one uses an "exit", rather than a "die", then the sequence
of tests are OK. I also tried making up a different
intermediate (rather than filter/in_error) test that didn't
involve filters but had a die() in it, but that was still
OK. So the intermediate test involving both a filter and a
die seems relevant ....

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message