Hi Folks,
Does anyone know what's going on here? I will be very thankful for a response!!
Does YAML::Tiny require one to untaint data read from a yaml file?
I recently changed my config file from Config::Tiny to YAML::Tiny
and after doing it I get a taint error message.
>>>> Insecure dependency in open while running with -T switch at testyc.pl ...
I have reduced the problem to test case below showing what's going on with using both config::tiny and yaml::tiny.
Using data from Config::Tiny does not produce an error when opening a file for output but data from YAML::Tiny does.
???
I am running:
This is perl, v5.10.0 built for i486-linux-gnu-thread-multi I have tried this w/ 1.39 and 1.41 of YAML::Tiny.
===== file: test.configtiny [dirs] dir_output_base=./ ===== file: test.yaml dirs: dir_output_base: ./ ===== testyc.pl (run as perl -wT testyc.pl ===== #!/usr/bin/perl -wT use strict; # ====================== use YAML::Tiny; my $yaml = YAML::Tiny->new; $yaml = YAML::Tiny->read( 'test.yaml' ); my $file1="testyc1.txt"; print "Printing to dir: " . $yaml->[0]->{dirs}->{dir_output_base}; print "\n"; print "Printing to file: " . $file1; print "\n"; # choose one of the following lines for tainted or untainted # my $ut = $yaml->[0]->{dirs}->{dir_output_base}; my $ut = $1 if ($yaml->[0]->{dirs}->{dir_output_base} =~ /(.*)/); + # the above line untaints anything, just for testing purpose here. open (my $outfile1, '>', $ut . $file1); print $outfile1 "hello from testyc.pl\n"; close($outfile1); # ====================== use Config::Tiny; my $config=Config::Tiny->read('test.configtiny'); my $file2="testyc2.txt"; print "Printing to dir: " . $config->{dirs}->{dir_output_base}; print "\n"; print "Printing to file: " . $file2; print "\n"; open (my $outfile2, '>', $config->{dirs}->{dir_output_base} . $fil +e2); print $outfile2 "hello from testyc.pl\n"; close($outfile2);
In reply to Do I really need to untaint from YAML::Tiny file? by proggerguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |