t5516: do not assume the "matching" push is the default
[gitweb.git] / t / t9502-gitweb-standalone-parse-output.sh
index 731e64c3adbd4d887bfa2c96eb060aa890377cfc..86dfee2e4f93750aa72c0b24df57c77faa091aa7 100755 (executable)
@@ -40,7 +40,7 @@ check_snapshot () {
        echo "basename=$basename"
        grep "filename=.*$basename.tar" gitweb.headers >/dev/null 2>&1 &&
        "$TAR" tf gitweb.body >file_list &&
-       ! grep -v "^$prefix/" file_list
+       ! grep -v -e "^$prefix$" -e "^$prefix/" -e "^pax_global_header$" file_list
 }
 
 test_expect_success setup '
@@ -185,5 +185,20 @@ test_expect_success 'forks: project_index lists all projects (incl. forks)' '
        test_cmp expected actual
 '
 
+xss() {
+       echo >&2 "Checking $1..." &&
+       gitweb_run "$1" &&
+       if grep "$TAG" gitweb.body; then
+               echo >&2 "xss: $TAG should have been quoted in output"
+               return 1
+       fi
+       return 0
+}
+
+test_expect_success 'xss checks' '
+       TAG="<magic-xss-tag>" &&
+       xss "a=rss&p=$TAG" &&
+       xss "a=rss&p=foo.git&f=$TAG"
+'
 
 test_done