Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I wrote a small index file for a website, it should read the contents from html files, and print them inside of a template.
what I'm concerned with is if the actual file passing method is secure enough:
this is what I have:
my $req = $ENV{QUERY_STRING}; $req =~ s/^.*\///; $req = 'index' if -e $req; my $page = "pages/$req.html"; $page = "pages/index.html" unless -e $page;
the pages are inside a pages/ folder, and the request is such that index.pl?about will give me the about.html page.
do you see any security flaw with this method? like being somehow able to go back in folders and read stuff you shouldn't be reading?
thank you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: request for review: file reading security
by cchampion (Curate) on Sep 05, 2004 at 10:45 UTC | |
by Anonymous Monk on Sep 05, 2004 at 14:32 UTC | |
|
Re: request for review: file reading security
by Zed_Lopez (Chaplain) on Sep 05, 2004 at 09:37 UTC | |
by Anonymous Monk on Sep 05, 2004 at 14:33 UTC | |
by pbeckingham (Parson) on Sep 05, 2004 at 14:58 UTC | |
by Chady (Priest) on Sep 05, 2004 at 15:57 UTC | |
|
Re: request for review: file reading security
by CountZero (Bishop) on Sep 05, 2004 at 12:39 UTC |