in reply to Re^3: Using relative paths with taint mode
in thread Using relative paths with taint mode
You don't just want to blindly untaint. You want to validate the input.
That makes sense...thanks
So, would a sensible approach be to check that $Bin resembles one of the places I expect it to be run from?
Something like this (untested):
The \w{2,4} allows for the different subdomains used for development, testing, etc.#!/usr/bin/perl -T use CGI::Carp qw(fatalsToBrowser); use FindBin qw($Bin); if ($Bin =~ /^(\/home\/someuser\/somewebsite\/\w{2,4}\/cgi-bin)/) { $Bin = $1; } use lib "$Bin"; use Site::HTML; use strict; use warnings;
I don't recall seeing anything like that in any other Perl code I've seen that uses FindBin and lib so I'm guessing there is a better way to do it...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Using relative paths with taint mode
by afoken (Chancellor) on Jun 20, 2021 at 09:37 UTC | |
|
Re^5: Using relative paths with taint mode
by ikegami (Patriarch) on Jun 20, 2021 at 06:35 UTC |