From 3c8913bbc676603072b03d568438e5bbafbc83b4 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 06:09:53 -1000 Subject: Gate a readme ending in a colon like a disk path trust-scan-config passed any readme holding a colon as a tracked file, while the parser takes one only when a path follows the colon, so a scanned repository could still name a file on disk outside itself. The two now share one test. --- tests/t0303-robustness.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/t0303-robustness.sh') diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index e1b7b3a..5cc7507 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -117,6 +117,16 @@ test_expect_success 'a filesystem readme from a scanned repository is refused' ' grep "Ignoring readme in " err ' +# A colon with nothing after it names no ref, so the setting is a path on +# disk and has to wait on trust like any other. +test_expect_success 'a readme ending in a colon is refused like a path on disk' ' + echo "outside the repository" >"scan/outside:" && + echo "readme=../outside:" >scan/b.git/cgitrc && + CGIT_CONFIG="$PWD/gitcfgrc" QUERY_STRING="url=b.git/about/" cgit >tmp 2>err && + grep "Ignoring readme in " err && + ! grep "outside the repository" tmp +' + # A repository served as html runs its pages on the site's own origin, so # the switch waits on trust like the keys that place markup. The warning has # to name the repository, which it did not for a key read from git config. -- cgit