security - Howto for simple pipe without shell escape in perl? -
my perl cgi program needs pass arbitrary latex math expression, provided anonymous untrusted malicious web user, (trusted) phantomjs script runs mathjax obtain svg. think want do
use perl6::slurp; $svg= slurp( $fname, "mathjax-script.js '$not_trusted_expr' |");
in many scripts had written in past, sanitize $not_trusted_expr containing characters approved list, latex expressive make feasible approach. user can provide $not_trusted_expr can contain literally anything---incl \' itself---and reasons.
so, need absolutely there no ways shell escape characters interpreted along way in travel of characters mathjax-script.js .
do read slurp doc correctly in believing that
my $svg=slurp( "-|", "mathjax-script.js", $not_trusted_expr );
is complete solution problem, because means shell never invoked?
/iaw
yes, perl6::slurp::slurp
wraps builtin open
function, , ... -|, $cmd, @args
syntax pass arguments directly system execvp
function (on unixy systems, perl6::slurp
doc allude to).
Comments
Post a Comment