Skip to content

Commit

Permalink
fixed critical security issue that can expose files on your system an…
Browse files Browse the repository at this point in the history
…d prepared emergency release
  • Loading branch information
kraih committed Apr 15, 2011
1 parent 769b502 commit b098549
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Changes
@@ -1,6 +1,6 @@
This file documents the revision history for Perl extension Mojolicious.

1.16 2011-03-19 00:00:00
1.17 2011-04-15 00:00:00
- Deprecated Mojolicious process method in favor of the on_process
attribute.
- Added Failraptor.
Expand Down Expand Up @@ -29,6 +29,10 @@ This file documents the revision history for Perl extension Mojolicious.
- Fixed small perldoc browser bug. (kberov)
- Fixed cookbook recipe. (moritz)

1.16 2011-04-15 00:00:00
- Emergency release for a critical security issue that can expose
files on your system, everybody should update!

1.15 2011-03-18 00:00:00
- Changed default log level in "production" mode from "error" to
"info".
Expand Down
4 changes: 3 additions & 1 deletion lib/Mojo/Path.pm
Expand Up @@ -80,6 +80,9 @@ sub parse {
$path =~ /^\// ? $self->leading_slash(1) : $self->leading_slash(0);
$path =~ /\/$/ ? $self->trailing_slash(1) : $self->trailing_slash(0);

# Unescape
url_unescape $path;

# Parse
my @parts;
for my $part (split '/', $path) {
Expand All @@ -91,7 +94,6 @@ sub parse {
$part = '' unless defined $part;

# Store
url_unescape $part;
push @parts, $part;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -42,7 +42,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Smiling Cat Face With Heart-Shaped Eyes';
our $VERSION = '1.16';
our $VERSION = '1.17';

# "These old doomsday devices are dangerously unstable.
# I'll rest easier not knowing where they are."
Expand Down
17 changes: 16 additions & 1 deletion t/mojo/path.t
Expand Up @@ -3,7 +3,7 @@
use strict;
use warnings;

use Test::More tests => 3;
use Test::More tests => 11;

# "This is the greatest case of false advertising I’ve seen since I sued the
# movie 'The Never Ending Story.'"
Expand All @@ -12,3 +12,18 @@ use_ok 'Mojo::Path';
my $path = Mojo::Path->new;
is $path->parse('/path')->to_string, '/path', 'right path';
is $path->parse('/path/0')->to_string, '/path/0', 'right path';

# Canonicalizing
$path = Mojo::Path->new(
'/%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd');
is "$path", '/../../../../../../../../../../etc/passwd', 'rigth result';
is $path->parts->[0], '..', 'right part';
is $path->canonicalize, '/../../../../../../../../../../etc/passwd',
'rigth result';
is $path->parts->[0], '..', 'right part';
$path = Mojo::Path->new(
'/%2ftest%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd');
is "$path", '/test/../../../../../../../../../etc/passwd', 'rigth result';
is $path->parts->[0], 'test', 'right part';
is $path->canonicalize, '/../../../../../../../../etc/passwd', 'rigth result';
is $path->parts->[0], '..', 'right part';

0 comments on commit b098549

Please sign in to comment.