From fb8ae0096651e8166eb4f6eaf04546e1afe26e7d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 15:34:51 -1000 Subject: Ask for the working auth pages through cgit_ok The unedited copy and the login page were requested through cgit_rc, so a page cut short or an error logged on the way passed. The owner and description checks on the login page could not fail either if the config lost them, so the same config with a filter that lets the visitor in now has to show both. --- tests/t0505-auth.sh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/tests/t0505-auth.sh b/tests/t0505-auth.sh index 27b3734..ddc33d5 100755 --- a/tests/t0505-auth.sh +++ b/tests/t0505-auth.sh @@ -109,8 +109,8 @@ test_expect_success CGIT_LUA 'point cgit at the unedited auth filter' ' ' test_expect_success CGIT_LUA 'an unedited copy protects nothing' ' - cgit_url "authy/log/" >tmp && - grep ">guarded commit" tmp + cgit_ok cgitrc "url=authy/log/" >tmp && + test_grep ">guarded commit" tmp ' # The secret has to be one not made yet, or a host secret already readable @@ -216,26 +216,32 @@ test_expect_success 'the login page keeps the repository to itself' ' EOF cgitrc_repo denyrc authy "root-desc=the whole site" "auth-filter=exec:$PWD/deny.sh" \ "repo.desc=the secret plan" "repo.owner=Mallory Owner" "repo.hide=1" && - cgit_rc denyrc "url=authy/log/" >tmp && - grep "

sign in

" tmp && - grep "

the whole site

" tmp && - grep "" tmp && - ! grep "secret plan" tmp && - ! grep "Mallory" tmp + cgit_ok denyrc "url=authy/log/" >tmp && + test_grep "

sign in

" tmp && + test_grep "

the whole site

" tmp && + test_grep "" tmp && + test_grep ! "secret plan" tmp && + test_grep ! "Mallory" tmp && + write_script letin.sh <<-\EOF && + exit 1 + EOF + sed "s|deny.sh|letin.sh|" denyrc >letinrc && + cgit_ok letinrc "url=authy/log/" >tmp && + test_grep "secret plan" tmp && + test_grep "Mallory Owner" tmp ' # The login page answers in place of whatever page was asked for, so it is # kept out of a search index, whatever the site allows for its own pages. test_expect_success 'the login page asks not to be indexed' ' - cgit_rc denyrc "url=authy/log/" >tmp && - grep "^Status: 200" tmp && - grep "" tmp && + cgit_ok denyrc "url=authy/log/" >tmp && + test_grep "" tmp && { echo "robots=" && cat denyrc } >norobotsrc && - cgit_rc norobotsrc "url=authy/log/" >tmp && - grep "" tmp + cgit_ok norobotsrc "url=authy/log/" >tmp && + test_grep "" tmp ' test_done -- cgit 2.12.1