Skip to content

Commit

Permalink
Item597: Added validatePerlModule check instead of untaintUnchecked. …
Browse files Browse the repository at this point in the history
…Hope it works :)

git-svn-id: http://svn.foswiki.org/trunk@1682 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OlivierRaginel authored and OlivierRaginel committed Jan 1, 2009
1 parent 9c3b660 commit 20d14a7
Show file tree
Hide file tree
Showing 2 changed files with 374 additions and 218 deletions.
18 changes: 18 additions & 0 deletions core/lib/Foswiki.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,24 @@ sub validatePattern {

=begin TML
---++ StaticMethod validatePerlModule( $module ) -> $module
Validate a perl module in a parameter to $module so that
random garbage are filtered out.
=cut

sub validatePerlModule {
my $module = shift;

# Remove all non alpha-numeric caracters and :
# Do not use \w as this is localized, and might be tainted
$module =~ s/[^a-zA-Z:]//g;
return $module;
}

=begin TML
---++ StaticMethod applyPatternToIncludedText( $text, $pattern ) -> $text
Apply a pattern on included text to extract a subset
Expand Down
Loading

0 comments on commit 20d14a7

Please sign in to comment.