plack/Plack

Authorize regexp in Plack::App::URLMap

matjmat opened this issue · 0 comments

Hi,
I understand that we cannot currently use regexp in the path when mounting an application, mainly due to:

 push @{$self->{_mapping}}, [ $host, $location, qr/^\Q$location\E/, $app ];

in: Plack::App::URLMap

I would like to know:

  • if there is a way to do it right now without modifying the code
  • what is the rational behing using the \Q and avoiding regexp (i suspect something linked to security reasons)
  • if it could be possible to add a $ENV parameter for authorizing the use of regexp in the map() something along:
    ``if ( $ENV{PLACK_URLMAP_ALLOWREGEX} ) {
    push @{$self->{_mapping}}, [ $host, $location, qr/^$location/, $app ];
    } else {
    push @{$self->{_mapping}}, [ $host, $location, qr/^\Q$location\E/, $app ];
    }
    (happy to provide a real patch if ok in the idea)

Best,
Mathieu