Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG File::Path 1.0402] Doesn't like running under taint mode. #645

Closed
p5pRT opened this issue Sep 21, 1999 · 1 comment
Closed

[BUG File::Path 1.0402] Doesn't like running under taint mode. #645

p5pRT opened this issue Sep 21, 1999 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Sep 21, 1999

Migrated from rt.perl.org#1518 (status was 'resolved')

Searchable as RT1518$

@p5pRT
Copy link
Author

p5pRT commented Sep 21, 1999

From @schwern

perl -MFile​::Path -Twle 'rmtree("foo")'
Insecure dependency in chmod while running with -T switch at /usr/local/perl5.005_61/lib/File/Path.pm line 168.

The problem lies in how it creates the list of files to recurse down​:

  my $d = DirHandle->new($root)
  or carp "Can't read $root​: $!";
  @​files = $d->read;
  $d->close;

  # Deleting large numbers of files from VMS Files-11 filesystems
  # is faster if done in reverse ASCIIbetical order
  @​files = reverse @​files if $Is_VMS;
  ($root = VMS​::Filespec​::unixify($root)) =~ s#\.dir$## if $Is_VMS;
  @​files = map("$root/$_", grep $_!~/^\.{1,2}$/,@​files);
  $count += rmtree(\@​files,$verbose,$safe);

@​files is tainted, since it is a list of files read from a Dirhandle.
So we can simply detaint @​files, but I'm loathe to be the one to do
that not having really examined the security issues therin.

--

Michael G Schwern schwern@​pobox.com
  http​://www.pobox.com/~schwern
  /(?​:(?​:(1)[.-]?)?\(?(\d{3})\)?[.-]?)?(\d{3})[.-]?(\d{4})(x\d+)?/i

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant