From 8d6578ad20f6ec89cf0226b8d75d6d3a306b0914 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 16:30:41 -1000 Subject: Test markup in a scanned repository's own words A scanned repository sets its description, owner and section without trust, and no test gave them any markup. --- tests/t0303-robustness.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests') diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index 841a031..2472bcd 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -909,4 +909,30 @@ test_expect_success 'blame turns away a binary file' ' test_grep "(blame)" tmp ' +# A scanned repository may set its description, owner and section without +# trust, so markup in them has to land escaped on the index and in the meta +# description of its own pages. +test_expect_success 'descriptive values from a scanned repository are escaped' ' + git clone -q --bare repos/rob/.git descscan/d.git && + cat >descscan/d.git/cgitrc <<-\EOF && + desc=desc & "q" '\''s + owner=owner & "q" '\''s + section=section & "q" '\''s + EOF + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "enable-index-owner=1" && + echo "scan-path=$PWD/descscan" + } >descrc && + cgit_ok descrc "url=" >tmp && + test_grep "desc <x> & \"q\" .s" tmp && + test_grep "owner <x> & \"q\" .s" tmp && + test_grep "class=.reposection.>section <x> & \"q\" .s" tmp && + test_grep ! "" tmp && + cgit_ok descrc "url=d.git/" >tmp && + test_grep "" tmp && + test_grep ! "" tmp +' + test_done -- cgit 2.12.1