summaryrefslogtreecommitdiff
path: root/t/t9121
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2015-02-17 14:09:24 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-02-17 13:15:30 -0800
commitb48537305229d1a4f25633f71941ee52d2582017 (patch)
treeddabe33825474779b662a1bf43eb85b24d830013 /t/t9121
parentt5570: test git-daemon's --interpolated-path option (diff)
downloadtgif-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 't/t9121')
0 files changed, 0 insertions, 0 deletions