Merge branch 'jk/maint-gitweb-xss'
authorJunio C Hamano <gitster@pobox.com>
Tue, 20 Nov 2012 18:37:27 +0000 (10:37 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 20 Nov 2012 18:37:27 +0000 (10:37 -0800)
Fixes an XSS vulnerability in gitweb.

* jk/maint-gitweb-xss:
gitweb: escape html in rss title

1  2 
gitweb/gitweb.perl
diff --combined gitweb/gitweb.perl
index ce8cb4af164e5e1918212e3d3cbd009fd8ba27f9,a51a8babeee1ca5388d12a2ec8ba4b417c86e4a3..e8812fa2b9145cf669193b2b148a0a8e6ee7ac09
@@@ -270,15 -270,16 +270,15 @@@ our %highlight_basename = 
  our %highlight_ext = (
        # main extensions, defining name of syntax;
        # see files in /usr/share/highlight/langDefs/ directory
 -      map { $_ => $_ }
 -              qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make),
 +      (map { $_ => $_ } qw(py rb java css js tex bib xml awk bat ini spec tcl sql)),
        # alternate extensions, see /etc/highlight/filetypes.conf
 -      'h' => 'c',
 -      map { $_ => 'sh'  } qw(bash zsh ksh),
 -      map { $_ => 'cpp' } qw(cxx c++ cc),
 -      map { $_ => 'php' } qw(php3 php4 php5 phps),
 -      map { $_ => 'pl'  } qw(perl pm), # perhaps also 'cgi'
 -      map { $_ => 'make'} qw(mak mk),
 -      map { $_ => 'xml' } qw(xhtml html htm),
 +      (map { $_ => 'c'   } qw(c h)),
 +      (map { $_ => 'sh'  } qw(sh bash zsh ksh)),
 +      (map { $_ => 'cpp' } qw(cpp cxx c++ cc)),
 +      (map { $_ => 'php' } qw(php php3 php4 php5 phps)),
 +      (map { $_ => 'pl'  } qw(pl perl pm)), # perhaps also 'cgi'
 +      (map { $_ => 'make'} qw(make mak mk)),
 +      (map { $_ => 'xml' } qw(xml xhtml html htm)),
  );
  
  # You define site-wide feature defaults here; override them with
@@@ -8054,6 -8055,7 +8054,7 @@@ sub git_feed 
                $feed_type = 'history';
        }
        $title .= " $feed_type";
+       $title = esc_html($title);
        my $descr = git_get_project_description($project);
        if (defined $descr) {
                $descr = esc_html($descr);