gitweb: Introduce esc_attr to escape attributes of HTML elements

It is needed only to escape attributes of handcrafted HTML elements,
and not those generated using CGI.pm subroutines / methods for HTML
generation.

While at it, add esc_url and esc_html where needed, and prefer to use
CGI.pm HTML generating methods than handcrafted HTML code.  Most of
those are probably unnecessary (could be exploited only by person with
write access to gitweb config, or at least access to the repository).

This fixes CVE-2010-3906

Reported-by: Emanuele Gentili <e.gentili@tigersecurity.it>
Helped-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 file changed
tree: de50397d2e5078ee325ea4e332b2825732639bd0
  1. arm/
  2. compat/
  3. contrib/
  4. Documentation/
  5. git-gui/
  6. gitk-git/
  7. gitweb/
  8. mozilla-sha1/
  9. perl/
  10. ppc/
  11. t/
  12. templates/
  13. xdiff/
  14. .gitattributes
  15. .gitignore
  16. .mailmap
  17. abspath.c
  18. alias.c
  19. alloc.c
  20. archive-tar.c
  21. archive-zip.c
  22. archive.c
  23. archive.h
  24. attr.c
  25. attr.h
  26. base85.c
  27. bisect.c
  28. bisect.h
  29. blob.c
  30. blob.h
  31. branch.c
  32. branch.h
  33. builtin-add.c
  34. builtin-annotate.c
  35. builtin-apply.c
  36. builtin-archive.c
  37. builtin-bisect--helper.c
  38. builtin-blame.c
  39. builtin-branch.c
  40. builtin-bundle.c
  41. builtin-cat-file.c
  42. builtin-check-attr.c
  43. builtin-check-ref-format.c
  44. builtin-checkout-index.c
  45. builtin-checkout.c
  46. builtin-clean.c
  47. builtin-clone.c
  48. builtin-commit-tree.c
  49. builtin-commit.c
  50. builtin-config.c
  51. builtin-count-objects.c
  52. builtin-describe.c
  53. builtin-diff-files.c
  54. builtin-diff-index.c
  55. builtin-diff-tree.c
  56. builtin-diff.c
  57. builtin-fast-export.c
  58. builtin-fetch--tool.c
  59. builtin-fetch-pack.c
  60. builtin-fetch.c
  61. builtin-fmt-merge-msg.c
  62. builtin-for-each-ref.c
  63. builtin-fsck.c
  64. builtin-gc.c
  65. builtin-grep.c
  66. builtin-help.c
  67. builtin-http-fetch.c
  68. builtin-init-db.c
  69. builtin-log.c
  70. builtin-ls-files.c
  71. builtin-ls-remote.c
  72. builtin-ls-tree.c
  73. builtin-mailinfo.c
  74. builtin-mailsplit.c
  75. builtin-merge-base.c
  76. builtin-merge-file.c
  77. builtin-merge-ours.c
  78. builtin-merge-recursive.c
  79. builtin-merge.c
  80. builtin-mktree.c
  81. builtin-mv.c
  82. builtin-name-rev.c
  83. builtin-pack-objects.c
  84. builtin-pack-refs.c
  85. builtin-prune-packed.c
  86. builtin-prune.c
  87. builtin-push.c
  88. builtin-read-tree.c
  89. builtin-receive-pack.c
  90. builtin-reflog.c
  91. builtin-remote.c
  92. builtin-rerere.c
  93. builtin-reset.c
  94. builtin-rev-list.c
  95. builtin-rev-parse.c
  96. builtin-revert.c
  97. builtin-rm.c
  98. builtin-send-pack.c
  99. builtin-shortlog.c
  100. builtin-show-branch.c
  101. builtin-show-ref.c
  102. builtin-stripspace.c
  103. builtin-symbolic-ref.c
  104. builtin-tag.c
  105. builtin-tar-tree.c
  106. builtin-unpack-objects.c
  107. builtin-update-index.c
  108. builtin-update-ref.c
  109. builtin-upload-archive.c
  110. builtin-verify-pack.c
  111. builtin-verify-tag.c
  112. builtin-write-tree.c
  113. builtin.h
  114. bundle.c
  115. bundle.h
  116. cache-tree.c
  117. cache-tree.h
  118. cache.h
  119. check-builtins.sh
  120. check-racy.c
  121. check_bindir
  122. color.c
  123. color.h
  124. combine-diff.c
  125. command-list.txt
  126. commit.c
  127. commit.h
  128. config.c
  129. config.mak.in
  130. configure.ac
  131. connect.c
  132. convert.c
  133. copy.c
  134. COPYING
  135. csum-file.c
  136. csum-file.h
  137. ctype.c
  138. daemon.c
  139. date.c
  140. decorate.c
  141. decorate.h
  142. delta.h
  143. diff-delta.c
  144. diff-lib.c
  145. diff-no-index.c
  146. diff.c
  147. diff.h
  148. diffcore-break.c
  149. diffcore-delta.c
  150. diffcore-order.c
  151. diffcore-pickaxe.c
  152. diffcore-rename.c
  153. diffcore.h
  154. dir.c
  155. dir.h
  156. editor.c
  157. entry.c
  158. environment.c
  159. exec_cmd.c
  160. exec_cmd.h
  161. fast-import.c
  162. fetch-pack.h
  163. fixup-builtins
  164. fsck.c
  165. fsck.h
  166. generate-cmdlist.sh
  167. git-add--interactive.perl
  168. git-am.sh
  169. git-archimport.perl
  170. git-bisect.sh
  171. git-compat-util.h
  172. git-cvsexportcommit.perl
  173. git-cvsimport.perl
  174. git-cvsserver.perl
  175. git-difftool--helper.sh
  176. git-difftool.perl
  177. git-filter-branch.sh
  178. git-instaweb.sh
  179. git-lost-found.sh
  180. git-merge-octopus.sh
  181. git-merge-one-file.sh
  182. git-merge-resolve.sh
  183. git-mergetool--lib.sh
  184. git-mergetool.sh
  185. git-parse-remote.sh
  186. git-pull.sh
  187. git-quiltimport.sh
  188. git-rebase--interactive.sh
  189. git-rebase.sh
  190. git-relink.perl
  191. git-repack.sh
  192. git-request-pull.sh
  193. git-send-email.perl
  194. git-sh-setup.sh
  195. git-stash.sh
  196. git-submodule.sh
  197. git-svn.perl
  198. GIT-VERSION-GEN
  199. git-web--browse.sh
  200. git.c
  201. git.spec.in
  202. graph.c
  203. graph.h
  204. grep.c
  205. grep.h
  206. hash-object.c
  207. hash.c
  208. hash.h
  209. help.c
  210. help.h
  211. http-push.c
  212. http-walker.c
  213. http.c
  214. http.h
  215. ident.c
  216. imap-send.c
  217. index-pack.c
  218. INSTALL
  219. levenshtein.c
  220. levenshtein.h
  221. list-objects.c
  222. list-objects.h
  223. ll-merge.c
  224. ll-merge.h
  225. lockfile.c
  226. log-tree.c
  227. log-tree.h
  228. mailmap.c
  229. mailmap.h
  230. Makefile
  231. match-trees.c
  232. merge-file.c
  233. merge-index.c
  234. merge-recursive.c
  235. merge-recursive.h
  236. merge-tree.c
  237. mktag.c
  238. name-hash.c
  239. object.c
  240. object.h
  241. pack-check.c
  242. pack-redundant.c
  243. pack-refs.c
  244. pack-refs.h
  245. pack-revindex.c
  246. pack-revindex.h
  247. pack-write.c
  248. pack.h
  249. pager.c
  250. parse-options.c
  251. parse-options.h
  252. patch-delta.c
  253. patch-id.c
  254. patch-ids.c
  255. patch-ids.h
  256. path.c
  257. pkt-line.c
  258. pkt-line.h
  259. preload-index.c
  260. pretty.c
  261. progress.c
  262. progress.h
  263. quote.c
  264. quote.h
  265. reachable.c
  266. reachable.h
  267. read-cache.c
  268. README
  269. reflog-walk.c
  270. reflog-walk.h
  271. refs.c
  272. refs.h
  273. remote.c
  274. remote.h
  275. rerere.c
  276. rerere.h
  277. revision.c
  278. revision.h
  279. run-command.c
  280. run-command.h
  281. send-pack.h
  282. server-info.c
  283. setup.c
  284. sha1-lookup.c
  285. sha1-lookup.h
  286. sha1_file.c
  287. sha1_name.c
  288. shallow.c
  289. shell.c
  290. shortlog.h
  291. show-index.c
  292. sideband.c
  293. sideband.h
  294. sigchain.c
  295. sigchain.h
  296. strbuf.c
  297. strbuf.h
  298. string-list.c
  299. string-list.h
  300. symlinks.c
  301. tag.c
  302. tag.h
  303. tar.h
  304. test-chmtime.c
  305. test-ctype.c
  306. test-date.c
  307. test-delta.c
  308. test-dump-cache-tree.c
  309. test-genrandom.c
  310. test-match-trees.c
  311. test-parse-options.c
  312. test-path-utils.c
  313. test-sha1.c
  314. test-sha1.sh
  315. test-sigchain.c
  316. thread-utils.c
  317. thread-utils.h
  318. trace.c
  319. transport.c
  320. transport.h
  321. tree-diff.c
  322. tree-walk.c
  323. tree-walk.h
  324. tree.c
  325. tree.h
  326. unimplemented.sh
  327. unpack-file.c
  328. unpack-trees.c
  329. unpack-trees.h
  330. update-server-info.c
  331. upload-pack.c
  332. usage.c
  333. userdiff.c
  334. userdiff.h
  335. utf8.c
  336. utf8.h
  337. var.c
  338. walker.c
  339. walker.h
  340. wrapper.c
  341. write_or_die.c
  342. ws.c
  343. wt-status.c
  344. wt-status.h
  345. xdiff-interface.c
  346. xdiff-interface.h