connect: reject paths that look like command line options
authorJeff King <peff@peff.net>
Fri, 28 Jul 2017 19:28:55 +0000 (15:28 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 Jul 2017 22:54:55 +0000 (15:54 -0700)
commitaeeb2d496859419ac1ba1da1162d6f3610f7f1f3
tree844124df0896caa172359b472bf436c8d13be969
parent3be4cf09cd3d0747af3ecdb8dc3962a0969b731e
connect: reject paths that look like command line options

If we get a repo path like "-repo.git", we may try to invoke
"git-upload-pack -repo.git". This is going to fail, since
upload-pack will interpret it as a set of bogus options. But
let's reject this before we even run the sub-program, since
we would not want to allow any mischief with repo names that
actually are real command-line options.

You can still ask for such a path via git-daemon, but there's no
security problem there, because git-daemon enters the repo itself
and then passes "."  on the command line.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
connect.c
t/t5810-proto-disable-local.sh
t/t5813-proto-disable-ssh.sh