Skip Menu |

This queue is for tickets about the Pod-Perldoc CPAN distribution.

Report information
The Basics
Id: 12769
Status: resolved
Priority: 0/
Queue: Pod-Perldoc

People
Owner: Nobody in particular
Requestors: wrsomsky [...] phys.washington.edu
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Pod::Usage::pod2usage -- calling 'perldoc' on $0 is tainted, unsafe
In version 1.16 of Pod::Usage -- and I see it is still extant in version 1.30 -- executing 'pod2usage (-verbose=>2)' w/in a 'taint enabled' (-T) script fails w/ the error "Insecure dependency in system while running with -T switch". Sample program: --->8--->8--- CUT HERE --->8--->8--- #!/usr/bin/perl -Tw use strict ; $ENV{'PATH'} = '/bin:/usr/bin' ; ### ($0) = $0 =~ /(.*)/ ; ### Detaint $0 use Pod::Usage ; pod2usage (-verbose=>2) ; __END__ =head1 NAME bug - Demonstrate Pod::Usage bug --->8--->8--- CUT HERE --->8--->8--- This is due to pod2usage trying to invoke 'perldoc' on $opts{"-input"}, which if otherwise unset, contains $0, the script file-path. (Note, this is after the understandable requirement to sanitize $ENV{PATH} is taken care of first.) One could take the approach of de-tainting $0 -- and uncommenting the 'Detaint' line in the above script does this -- and this then works in the simple and usual case, but 'perldoc' isn't secure w/ an arbitrary file-path (at least in my current version; a separate bug). Eg, in the above example, try uncommenting the 'Detaint' line, copying the script to the oddly-named file 'a;b', and then running it. I get results like: proteus #] cp bug a\;b proteus #] ./a\;b Can't open ./a for reading: No such file or directory at /usr/bin/pod2man line 60 sh: b: command not found Got a 0-length file from ./a;b via Pod::Perldoc::ToMan!? So... should Pod::Usage::pod2usage really be invoking 'perldoc'? This all is running on a RedHat Enteprise WS 4 system, w/ perl v5.8.5, and Pod::Usage v1.16 (perldoc v3.13 if that's relevant for part two)
RT-Send-CC: sburke [...] cpan.org,rra [...] stanford.edu
After analyzing Pod::Usage I come to the conclusion that this problem has its root cause not in Pod::Usage; Pod::Usage determines the external command like this: my $progpath = File::Spec->catfile($Config{scriptdir}, "perldoc"); system($progpath, $opts{"-input"}); Which is an absolute path, and the system(LIST) does not start a shell in between. I think that the problem is rather in perldoc, which calls pod2man with the unsafe argument. Sean, Russ, any comments? -Marek
I'm looking at this an hope to have a fix soon
Instead of calling pod2man, I'm calling Pod::Man directly so this should be fixed once I integrate the podman branch in my Github repo.