]> git.ipfire.org Git - thirdparty/git.git/commit - serve.c
upload-pack: disallow object-info capability by default
authorTaylor Blau <me@ttaylorr.com>
Wed, 28 Feb 2024 22:38:58 +0000 (17:38 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Feb 2024 22:42:01 +0000 (14:42 -0800)
commit8c735b11decc96d673140b268e4a257629e1dad4
tree915dfd83d3cdbae05a962343d9213fdb15a76275
parent179776f9e6c4bd2f423c78fcf8b1e4cb4afc4c45
upload-pack: disallow object-info capability by default

We added an "object-info" capability to the v2 upload-pack protocol in
a2ba162cda (object-info: support for retrieving object info,
2021-04-20). In the almost 3 years since, we have not added any
client-side support, and it does not appear to exist in other
implementations either (JGit understands the verb on the server side,
but not on the client side).

Since this largely unused code is accessible over the network by
default, it increases the attack surface of upload-pack. I don't know of
any particularly severe problem, but one issue is that because of the
request/response nature of the v2 protocol, it will happily read an
unbounded number of packets, adding each one to a string list (without
regard to whether they are objects we know about, duplicates, etc).

This may be something we want to improve in the long run, but in the
short term it makes sense to disable the feature entirely. We'll add a
config option as an escape hatch for anybody who wants to develop the
feature further.

A more gentle option would be to add the config option to let people
disable it manually, but leave it enabled by default. But given that
there's no client side support, that seems like the wrong balance with
security.

Disabling by default will slow adoption a bit once client-side support
does become available (there were some patches[1] in 2022, but nothing
got merged and there's been nothing since). But clients have to deal
with older servers that do not understand the option anyway (and the
capability system handles that), so it will just be a matter of servers
flipping their config at that point (and hopefully once any unbounded
allocations have been addressed).

[jk: this is a patch that GitHub has been running for several years, but
     rebased forward and with a new commit message for upstream]

[1] https://lore.kernel.org/git/20220208231911.725273-1-calvinwan@google.com/

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/transfer.txt
serve.c
t/t5555-http-smart-common.sh
t/t5701-git-serve.sh