diff options
Diffstat (limited to 'rt/bin')
| -rwxr-xr-x | rt/bin/fastcgi_server | 12 | ||||
| -rwxr-xr-x | rt/bin/mason_handler.fcgi | 11 | ||||
| -rwxr-xr-x | rt/bin/mason_handler.scgi | 12 | ||||
| -rw-r--r-- | rt/bin/mason_handler.svc | 11 | ||||
| -rwxr-xr-x | rt/bin/rt-mailgate | 4 | ||||
| -rw-r--r-- | rt/bin/rt-mailgate.in | 2 |
6 files changed, 49 insertions, 3 deletions
diff --git a/rt/bin/fastcgi_server b/rt/bin/fastcgi_server index 7c0935dfe..f5da52422 100755 --- a/rt/bin/fastcgi_server +++ b/rt/bin/fastcgi_server @@ -231,6 +231,18 @@ while ( my $cgi = CGI::Fast->new ) { Module::Refresh->refresh if RT->Config->Get('DevelMode'); RT::ConnectToDatabase(); + # Each environment has its own way of handling .. and so on in paths, + # so RT consistently forbids such paths. + if ( $cgi->path_info =~ m{/\.} ) { + $RT::Logger->crit("Invalid request for ".$cgi->path_info." aborting"); + print STDOUT "HTTP/1.0 400\r\n\r\n"; + + RT::Interface::Web::Handler->CleanupRequest(); + $proc_manager->pm_post_dispatch; + + next; + } + my $interp = $RT::Mason::Handler->interp; if ( !$interp->comp_exists( $cgi->path_info ) diff --git a/rt/bin/mason_handler.fcgi b/rt/bin/mason_handler.fcgi index 432296be7..996e96076 100755 --- a/rt/bin/mason_handler.fcgi +++ b/rt/bin/mason_handler.fcgi @@ -68,6 +68,17 @@ while ( my $cgi = CGI::Fast->new ) { Module::Refresh->refresh if RT->Config->Get('DevelMode'); RT::ConnectToDatabase(); + # Each environment has its own way of handling .. and so on in paths, + # so RT consistently forbids such paths. + if ( $cgi->path_info =~ m{/\.} ) { + $RT::Logger->crit("Invalid request for ".$cgi->path_info." aborting"); + print STDOUT "HTTP/1.0 400\r\n\r\n"; + + RT::Interface::Web::Handler->CleanupRequest(); + + next; + } + my $interp = $RT::Mason::Handler->interp; if ( !$interp->comp_exists( $cgi->path_info ) diff --git a/rt/bin/mason_handler.scgi b/rt/bin/mason_handler.scgi index 5cbb9a30f..83649edaf 100755 --- a/rt/bin/mason_handler.scgi +++ b/rt/bin/mason_handler.scgi @@ -57,6 +57,18 @@ require (dirname(__FILE__) . '/webmux.pl'); require CGI; my $cgi = CGI->new; + +# Each environment has its own way of handling .. and so on in paths, +# so RT consistently forbids such paths. +if ( $cgi->path_info =~ m{/\.} ) { + $RT::Logger->crit("Invalid request for ".$cgi->path_info." aborting"); + print STDOUT "HTTP/1.0 400\r\n\r\n"; + + RT::Interface::Web::Handler->CleanupRequest(); + + return 0; +} + if ( ( !$Handler->interp->comp_exists( $cgi->path_info ) ) && ( $Handler->interp->comp_exists( $cgi->path_info . "/index.html" ) ) ) { $cgi->path_info( $cgi->path_info . "/index.html" ); diff --git a/rt/bin/mason_handler.svc b/rt/bin/mason_handler.svc index ceb6cbcd9..6275a9e59 100644 --- a/rt/bin/mason_handler.svc +++ b/rt/bin/mason_handler.svc @@ -234,6 +234,17 @@ $Handler ||= RT::Interface::Web::Handler->new( while( my $cgi = CGI::Fast->new ) { my $comp = $ENV{'PATH_INFO'}; + # Each environment has its own way of handling .. and so on in paths, + # so RT consistently forbids such paths. + if ( $cgi->path_info =~ m{/\.} ) { + $RT::Logger->crit("Invalid request for ".$cgi->path_info." aborting"); + print STDOUT "HTTP/1.0 400\r\n\r\n"; + + RT::Interface::Web::Handler->CleanupRequest(); + + next; + } + $comp = $1 if ($comp =~ /^(.*)$/); my $web_path = RT->Config->Get('WebPath'); $comp =~ s|^\Q$web_path\E\b||i; diff --git a/rt/bin/rt-mailgate b/rt/bin/rt-mailgate index 7ffa7661a..b552c21da 100755 --- a/rt/bin/rt-mailgate +++ b/rt/bin/rt-mailgate @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w # BEGIN BPS TAGGED BLOCK {{{ # # COPYRIGHT: @@ -186,7 +186,7 @@ sub write_down_message { print STDERR "$0: Couldn't create temp file, using memory\n"; print STDERR "error: $@\n" if $@; - my $message = \do { local (@ARGV, $/); <> }; + my $message = \do { local (@ARGV, $/); <STDIN> }; unless ( $$message =~ /\S/ ) { print STDERR "$0: no message passed on STDIN\n"; exit 0; diff --git a/rt/bin/rt-mailgate.in b/rt/bin/rt-mailgate.in index 8b72d8294..4104836de 100644 --- a/rt/bin/rt-mailgate.in +++ b/rt/bin/rt-mailgate.in @@ -186,7 +186,7 @@ sub write_down_message { print STDERR "$0: Couldn't create temp file, using memory\n"; print STDERR "error: $@\n" if $@; - my $message = \do { local (@ARGV, $/); <> }; + my $message = \do { local (@ARGV, $/); <STDIN> }; unless ( $$message =~ /\S/ ) { print STDERR "$0: no message passed on STDIN\n"; exit 0; |
