I need to let users via a web interface, to tell the server to move a file from one place to another (i don't like this either).
This file is on a chunk of filetree that is mounted... So, it seems I need to use backticks and mv command. stuff like File::Copy will not steadily work accross filesystems
I'm running -Tw, and it's getting really angry at me for this.. I'm having a hard time untainting paths like /this/that/that/etc
I get this: Insecure $ENV{PATH} while running with -T switch at move.cgi line 148
This is my untainting and moving..
my %a=(); #their files may have @ signs, yea.. sigh # from if ("$$DMS{CONF}{DOC}/$filepath"=~m/^([\/_\@\w .-]+)$/){ $a{from} = $1; } #to if ("$$DMS{CONF}{DOC}/$$DMS{S}{session_file}/$$DMS{F}{$filepath}{file_ +name}"=~m/^([\/_\@\w .-]+)$/){ $a{to}=$1; } $a{from}=~m/\w/ or die("from failed untaint"); $a{to}=~m/\w/ or die("to failed untaint"); my $err = `mv "$a{from}" "$a{to}"`; # and here we freak out if ($err){ die("mov problem.. [$err]"); }
Is there some other way I should be untainting a path?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |