]> Sergey Matveev's repositories - public-inbox.git/commitdiff
githttpbackend: require ASCII in path
authorEric Wong <e@80x24.org>
Tue, 4 Jun 2019 08:58:32 +0000 (08:58 +0000)
committerEric Wong <e@80x24.org>
Tue, 4 Jun 2019 10:06:18 +0000 (10:06 +0000)
We mainly support git-upload-pack; and maybe somebody uses
git-receive-pack with this.  Perhaps other (experimental)
command names are acceptable.  But it's unlikely anybody will
want Unicode command names for git services.

lib/PublicInbox/GitHTTPBackend.pm

index e871bdde941901b88e2c6a02d14bf50008de6443..a2a81f8ea66a2dbe3ed81f885a5fda945e71bb38 100644 (file)
@@ -51,8 +51,8 @@ sub serve {
 
        # Documentation/technical/http-protocol.txt in git.git
        # requires one and exactly one query parameter:
-       if ($env->{QUERY_STRING} =~ /\Aservice=git-\w+-pack\z/ ||
-                               $path =~ /\Agit-\w+-pack\z/) {
+       if ($env->{QUERY_STRING} =~ /\Aservice=git-[A-Za-z0-9_]+-pack\z/ ||
+                               $path =~ /\Agit-[A-Za-z0-9_]+-pack\z/) {
                my $ok = serve_smart($env, $git, $path);
                return $ok if $ok;
        }