#!/bin/sh # Regression tests from the audits of September and October 2026. Each case # is a config, repository or request that used to crash cgit, end it inside # git, or hand a visitor something other than what was asked for. test_description='Check the audit regressions' . ./setup.sh test_expect_success 'set up a repository and a config to vary' ' mkrepo repos/rob 3 && sha=$(git -C repos/rob rev-parse HEAD~1) && cgitrc_repo robrc rob snapshots=tar.gz ' test_expect_success 'a repository without a path answers 404' ' { echo "virtual-root=/" && echo "cache-size=0" && echo "repo.url=nopath" && echo "repo.url=emptypath" && echo "repo.path=" } >nopathrc && for r in nopath emptypath do cgit_rc nopathrc "url=$r/log/" >tmp && grep "^Status: 404 Not Found" tmp && grep "Failed to open $r: Not a valid git repository" tmp || return 1 done ' # The index dates a repository from files under its path, and one without a # path has none, whatever sits in the working directory. test_expect_success 'a repository without a path has no age on the index' ' mkdir -p "(null)/refs/heads" && >"(null)/refs/heads/master" && cgit_rc nopathrc "url=" >tmp && grep "" tmp && ! grep "