From a734ef04d423618da33e338b5ca99a14b7864e14 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 14 Oct 2026 22:32:49 -1000 Subject: Serve only the files a dumb clone asks for The object path check let any run of safe characters through, so a spelling such as info//alternates or info/./alternates reached the alternates file the exact name was refused for. --- tests/t0303-robustness.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/t0303-robustness.sh') diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index ecd6129..f2f8572 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -592,9 +592,13 @@ test_expect_success 'the dumb transport sends a file with its size' ' test_expect_success 'the dumb transport withholds the alternates file' ' mkdir -p repos/rob/.git/objects/info && echo "$PWD/repos/foo/.git/objects" >repos/rob/.git/objects/info/alternates && - robq "url=rob/objects/info/alternates" >tmp && - grep "^Status: 404" tmp && - ! grep "repos/foo" tmp && + for path in info/alternates info//alternates info/./alternates ./info/alternates \ + info/Alternates /info/alternates + do + robq "url=rob/objects/$path" >tmp && + grep "^Status: 404" tmp && + ! grep "repos/foo" tmp || return 1 + done && rm repos/rob/.git/objects/info/alternates && robq "url=rob/objects/info/packs" >tmp && grep "^Status: 200" tmp -- cgit 2.12.1