From 56a634598d173a982733b1eff5c9c9a4eef55540 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Tue, 15 Sep 2026 20:44:57 -1000 Subject: Gate scanned filters with `trust-scan-filters` --- tests/extensions/lib.sh | 1 - tests/setup.sh | 1 - tests/t0205-config.sh | 34 ++++++++++++++++++++++++++++++---- tests/t0206-trailers.sh | 1 - tests/t0501-about-render.sh | 1 - tests/t0502-syntax-highlight.sh | 1 - tests/t0503-link-commits.sh | 1 - tests/t0504-email-avatar.sh | 1 - tests/t0506-link-trailers.sh | 1 - 9 files changed, 30 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/extensions/lib.sh b/tests/extensions/lib.sh index 26fcbec..ec1ef85 100644 --- a/tests/extensions/lib.sh +++ b/tests/extensions/lib.sh @@ -59,7 +59,6 @@ cgit_lua_probe() { cat >lua-probe-cgitrc <scan/foo.git/cgitrc && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "scan-path=$PWD/scan" + } >scanrc && + CGIT_CONFIG="$PWD/scanrc" QUERY_STRING="url=foo.git/commit/" cgit >tmp 2>err && + grep "
commit 5" tmp && + grep "Ignoring commit-filter in $PWD/scan/foo.git/: trust-scan-filters is not set" err +' + +test_expect_success 'the flag lets a scanned repository set its filters' ' + { + echo "trust-scan-filters=1" && + cat scanrc + } >scanrc-on && + CGIT_CONFIG="$PWD/scanrc-on" QUERY_STRING="url=foo.git/commit/" cgit >tmp 2>err && + grep "
COMMIT 5" tmp && + ! grep "Ignoring" err +' + +test_expect_success 'a repo filter in the main cgitrc needs no flag' ' + ! grep "about-filter" err && + CGIT_CONFIG="$PWD/earlyrc" QUERY_STRING="url=diag/" cgit >tmp 2>err && + ! grep "about-filter" err ' test_expect_success 'a fully understood config stays silent' ' diff --git a/tests/t0206-trailers.sh b/tests/t0206-trailers.sh index 75c59a1..e8e615c 100755 --- a/tests/t0206-trailers.sh +++ b/tests/t0206-trailers.sh @@ -42,7 +42,6 @@ test_expect_success 'point cgit at it with trailers on and the dump filters' ' virtual-root=/ cache-size=0 enable-trailers=1 - enable-filter-overrides=1 repo.url=trailers repo.path=$PWD/repos/trailers/.git repo.trailer-filter=exec:$FILTER_DIRECTORY/dump.sh diff --git a/tests/t0501-about-render.sh b/tests/t0501-about-render.sh index c2fdb71..f870c0e 100755 --- a/tests/t0501-about-render.sh +++ b/tests/t0501-about-render.sh @@ -46,7 +46,6 @@ test_expect_success 'point cgit at it through the about filter' ' cat >cgitrc <<-EOF virtual-root=/ cache-size=0 - enable-filter-overrides=1 repo.url=md repo.path=$PWD/repos/md/.git repo.readme=master:README.md diff --git a/tests/t0502-syntax-highlight.sh b/tests/t0502-syntax-highlight.sh index a6e3fcb..31ab7e7 100755 --- a/tests/t0502-syntax-highlight.sh +++ b/tests/t0502-syntax-highlight.sh @@ -54,7 +54,6 @@ test_expect_success 'place the fake lexers beside a config naming the filter' ' cat >cgitrc <<-EOF virtual-root=/ cache-size=0 - enable-filter-overrides=1 repo.url=fake repo.path=$PWD/repos/fake/.git repo.source-filter=lua:$EXTENSIONS_DIRECTORY/syntax-highlight.lua diff --git a/tests/t0503-link-commits.sh b/tests/t0503-link-commits.sh index 1dfb28c..d977517 100755 --- a/tests/t0503-link-commits.sh +++ b/tests/t0503-link-commits.sh @@ -40,7 +40,6 @@ test_expect_success 'point cgit at it through the commit filter' ' cat >cgitrc <<-EOF virtual-root=/ cache-size=0 - enable-filter-overrides=1 repo.url=linky repo.path=$PWD/repos/linky/.git repo.commit-filter=lua:$EXTENSIONS_DIRECTORY/link-commits.lua diff --git a/tests/t0504-email-avatar.sh b/tests/t0504-email-avatar.sh index 1af8988..91ddc20 100755 --- a/tests/t0504-email-avatar.sh +++ b/tests/t0504-email-avatar.sh @@ -57,7 +57,6 @@ test_expect_success CGIT_LUA_OSSL 'point cgit at it through the email filter' ' cat >cgitrc <<-EOF virtual-root=/ cache-size=0 - enable-filter-overrides=1 repo.url=avatar repo.path=$PWD/repos/avatar/.git repo.email-filter=lua:$EXTENSIONS_DIRECTORY/email-gravatar.lua diff --git a/tests/t0506-link-trailers.sh b/tests/t0506-link-trailers.sh index d397309..f6fedf2 100755 --- a/tests/t0506-link-trailers.sh +++ b/tests/t0506-link-trailers.sh @@ -47,7 +47,6 @@ test_expect_success 'point cgit at it through the trailer filter' ' virtual-root=/ cache-size=0 enable-trailers=1 - enable-filter-overrides=1 repo.url=linky repo.path=$PWD/repos/linky/.git repo.trailer-filter=lua:$EXTENSIONS_DIRECTORY/link-trailers.lua -- cgit v2.8.0