in reply to Mitigating ". in @INC" for optional dependencies
no lib q{.}; # mitigate the ". in @INC" security threat vector # when using optional dependencies
Well,if you talk security, you should use -T anyways. See perlrun and perlsec for "Taint mode", which implies "." not being included in @INC.
As a (weaker) alternative, you could localize @INC in your eval block:
@ARGV = Win32::CommandLine::argv() if eval { local @INC = grep !/^\.$/, @INC; # LHS is localized, RHS gets glob +al @INC require Win32::CommandLine; };
This localized restriction then applies to all modules loaded by Win32::CommandLine as well, but not to subsequent code in your script-foo.pl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Mitigating ". in @INC" for optional dependencies
by Wyrdweaver (Beadle) on Sep 10, 2016 at 20:54 UTC | |
by shmem (Chancellor) on Sep 10, 2016 at 21:22 UTC |