summaryrefslogtreecommitdiff
path: root/t/t9502-gitweb-standalone-parse-output.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-11-12 21:34:28 (GMT)
committerJeff King <peff@peff.net>2012-11-12 21:34:53 (GMT)
commit0f0ecf68b31303de7cb428554e27d433fe62180e (patch)
treed1f8f5902fb5ff6dd45ba21e6fce2a5d6e7f185d /t/t9502-gitweb-standalone-parse-output.sh
parent7e2010537e96d0a1144520222f20ba1dc3d61441 (diff)
downloadgit-0f0ecf68b31303de7cb428554e27d433fe62180e.zip
git-0f0ecf68b31303de7cb428554e27d433fe62180e.tar.gz
git-0f0ecf68b31303de7cb428554e27d433fe62180e.tar.bz2
gitweb: escape html in rss title
The title of an RSS feed is generated from many components, including the filename provided as a query parameter, but we failed to quote it. Besides showing the wrong output, this is a vector for XSS attacks. Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 't/t9502-gitweb-standalone-parse-output.sh')
-rwxr-xr-xt/t9502-gitweb-standalone-parse-output.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh
index 731e64c..3a8e7d3 100755
--- a/t/t9502-gitweb-standalone-parse-output.sh
+++ b/t/t9502-gitweb-standalone-parse-output.sh
@@ -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