Use static analysis to find potential web security vulnerabilities in legacy Perl code bases. Presented at Perl Oasis in Orlando, FL. January 14, 2012.
DOES. Or your boss, a third-party auditing company, your partner’s boyfriend, or certain members of the Perl community who shall remain anonymous (no guessing; chuckle if you know). Sunday, January 15, 12
use Perl::Critic::Utils qw[:all]; use base 'Perl::Critic::Policy'; Readonly::Scalar my $DESC => 'For Stuff'; Readonly::Scalar my $EXPL => [45]; Sunday, January 15, 12
base 'Perl::Critic::Policy'; Readonly::Scalar my $DESC => 'Suspect output in CGI script'; Readonly::Scalar my $EXPL => 'Potential XSS attack vulnerability'; Sunday, January 15, 12
Quoted String • A String Literal • A Double Quoted String without Interpolations • An Quote-like operator (qq{}) without Interpolations • A Literal Here Doc Sunday, January 15, 12
my $wdoc = PPI::Document->new(\$word); my ($first) = $wdoc-> find_first('PPI::Statement')-> schildren; if ($first && $first->isa('PPI::Token::Quote')) { # We should traverse this... } } Sunday, January 15, 12
my $wdoc = PPI::Document->new(\$word); # If this word is quoted, traverse. my $sym = $wdoc-> find_first('PPI::Token::Symbol'); next unless $sym; push @vars, $sym; } Sunday, January 15, 12