aboutsummaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-02-17 14:09:24 -0500
committerJunio C Hamano <gitster@pobox.com>2015-02-17 13:15:30 -0800
commitb48537305229d1a4f25633f71941ee52d2582017 (patch)
treeddabe33825474779b662a1bf43eb85b24d830013 /connect.c
parent5248f2dd4fe763ef9d1267f50481deee36ee57c1 (diff)
downloadgit-b48537305229d1a4f25633f71941ee52d2582017.tar.gz
git-b48537305229d1a4f25633f71941ee52d2582017.tar.xz
daemon: sanitize incoming virtual hostname
We use the daemon_avoid_alias function to make sure that the pathname the user gives us is sane. However, after applying that check, we might then interpolate the path using a string given by the server admin, but which may contain more untrusted data from the client. We should be sure to sanitize this data, as well. We cannot use daemon_avoid_alias here, as it is more strict than we need in requiring a leading '/'. At the same time, we can be much more strict here. We are interpreting a hostname, which should not contain slashes or excessive runs of dots, as those things are not allowed in DNS names. Note that in addition to cleansing the hostname field, we must check the "canonical hostname" (%CH) as well as the port (%P), which we take as a raw string. For the canonical hostname, this comes from an actual DNS lookup on the accessed IP, which makes it a much less likely vector for problems. But it does not hurt to sanitize it in the same way. Unfortunately we cannot test this case easily, as it would involve a custom hostname lookup. We do not need to check %IP, as it comes straight from inet_ntop, so must have a sane form. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
0 files changed, 0 insertions, 0 deletions