Skip to content

Commit 326922f

Browse files
committed
Merge branch 'jk/maint-gitweb-xss' into maint
Fixes an XSS vulnerability in gitweb. * jk/maint-gitweb-xss: gitweb: escape html in rss title
2 parents 4db42b3 + 0f0ecf6 commit 326922f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

gitweb/gitweb.perl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8055,6 +8055,7 @@ sub git_feed {
80558055
$feed_type = 'history';
80568056
}
80578057
$title .= " $feed_type";
8058+
$title = esc_html($title);
80588059
my $descr = git_get_project_description($project);
80598060
if (defined $descr) {
80608061
$descr = esc_html($descr);

t/t9502-gitweb-standalone-parse-output.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,20 @@ test_expect_success 'forks: project_index lists all projects (incl. forks)' '
185185
test_cmp expected actual
186186
'
187187

188+
xss() {
189+
echo >&2 "Checking $1..." &&
190+
gitweb_run "$1" &&
191+
if grep "$TAG" gitweb.body; then
192+
echo >&2 "xss: $TAG should have been quoted in output"
193+
return 1
194+
fi
195+
return 0
196+
}
197+
198+
test_expect_success 'xss checks' '
199+
TAG="<magic-xss-tag>" &&
200+
xss "a=rss&p=$TAG" &&
201+
xss "a=rss&p=foo.git&f=$TAG"
202+
'
188203

189204
test_done

0 commit comments

Comments
 (0)