http: respect protocol.*.allow=user for http-alternates

The http-walker may fetch the http-alternates (or
alternates) file from a remote in order to find more
objects. This should count as a "not from the user" use of
the protocol. But because we implement the redirection
ourselves and feed the new URL to curl, it will use the
CURLOPT_PROTOCOLS rules, not the more restrictive
CURLOPT_REDIR_PROTOCOLS.

The ideal solution would be for each curl request we make to
know whether or not is directly from the user or part of an
alternates redirect, and then set CURLOPT_PROTOCOLS as
appropriate. However, that would require plumbing that
information through all of the various layers of the http
code.

Instead, let's check the protocol at the source: when we are
parsing the remote http-alternates file. The only downside
is that if there's any mismatch between what protocol we
think it is versus what curl thinks it is, it could violate
the policy.

To address this, we'll make the parsing err on the picky
side, and only allow protocols that it can parse
definitively. So for example, you can't elude the "http"
policy by asking for "HTTP://", even though curl might
handle it; we would reject it as unknown. The only unsafe
case would be if you have a URL that starts with "http://"
but curl interprets as another protocol. That seems like an
unlikely failure mode (and we are still protected by our
base CURLOPT_PROTOCOL setting, so the worst you could do is
trigger one of https, ftp, or ftps).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 files changed
tree: 7101db7492d3eb86db6d4c710a30a904ff37b43a
  1. block-sha1/
  2. builtin/
  3. ci/
  4. compat/
  5. contrib/
  6. Documentation/
  7. ewah/
  8. git-gui/
  9. gitk-git/
  10. gitweb/
  11. mergetools/
  12. perl/
  13. po/
  14. ppc/
  15. refs/
  16. t/
  17. templates/
  18. vcs-svn/
  19. xdiff/
  20. .gitattributes
  21. .gitignore
  22. .mailmap
  23. .travis.yml
  24. abspath.c
  25. aclocal.m4
  26. advice.c
  27. advice.h
  28. alias.c
  29. alloc.c
  30. archive-tar.c
  31. archive-zip.c
  32. archive.c
  33. archive.h
  34. argv-array.c
  35. argv-array.h
  36. attr.c
  37. attr.h
  38. base85.c
  39. bisect.c
  40. bisect.h
  41. blob.c
  42. blob.h
  43. branch.c
  44. branch.h
  45. builtin.h
  46. bulk-checkin.c
  47. bulk-checkin.h
  48. bundle.c
  49. bundle.h
  50. cache-tree.c
  51. cache-tree.h
  52. cache.h
  53. check-builtins.sh
  54. check-racy.c
  55. check_bindir
  56. color.c
  57. color.h
  58. column.c
  59. column.h
  60. combine-diff.c
  61. command-list.txt
  62. commit-slab.h
  63. commit.c
  64. commit.h
  65. common-main.c
  66. config.c
  67. config.mak.in
  68. config.mak.uname
  69. configure.ac
  70. connect.c
  71. connect.h
  72. connected.c
  73. connected.h
  74. convert.c
  75. convert.h
  76. copy.c
  77. COPYING
  78. credential-cache--daemon.c
  79. credential-cache.c
  80. credential-store.c
  81. credential.c
  82. credential.h
  83. csum-file.c
  84. csum-file.h
  85. ctype.c
  86. daemon.c
  87. date.c
  88. decorate.c
  89. decorate.h
  90. delta.h
  91. diff-delta.c
  92. diff-lib.c
  93. diff-no-index.c
  94. diff.c
  95. diff.h
  96. diffcore-break.c
  97. diffcore-delta.c
  98. diffcore-order.c
  99. diffcore-pickaxe.c
  100. diffcore-rename.c
  101. diffcore.h
  102. dir.c
  103. dir.h
  104. editor.c
  105. entry.c
  106. environment.c
  107. exec_cmd.c
  108. exec_cmd.h
  109. fast-import.c
  110. fetch-pack.c
  111. fetch-pack.h
  112. fmt-merge-msg.h
  113. fsck.c
  114. fsck.h
  115. generate-cmdlist.sh
  116. gettext.c
  117. gettext.h
  118. git-add--interactive.perl
  119. git-archimport.perl
  120. git-bisect.sh
  121. git-compat-util.h
  122. git-cvsexportcommit.perl
  123. git-cvsimport.perl
  124. git-cvsserver.perl
  125. git-difftool--helper.sh
  126. git-difftool.perl
  127. git-filter-branch.sh
  128. git-instaweb.sh
  129. git-merge-octopus.sh
  130. git-merge-one-file.sh
  131. git-merge-resolve.sh
  132. git-mergetool--lib.sh
  133. git-mergetool.sh
  134. git-p4.py
  135. git-parse-remote.sh
  136. git-quiltimport.sh
  137. git-rebase--am.sh
  138. git-rebase--interactive.sh
  139. git-rebase--merge.sh
  140. git-rebase.sh
  141. git-relink.perl
  142. git-remote-testgit.sh
  143. git-request-pull.sh
  144. git-send-email.perl
  145. git-sh-i18n.sh
  146. git-sh-setup.sh
  147. git-stash.sh
  148. git-submodule.sh
  149. git-svn.perl
  150. GIT-VERSION-GEN
  151. git-web--browse.sh
  152. git.c
  153. git.rc
  154. gpg-interface.c
  155. gpg-interface.h
  156. graph.c
  157. graph.h
  158. grep.c
  159. grep.h
  160. hashmap.c
  161. hashmap.h
  162. help.c
  163. help.h
  164. hex.c
  165. http-backend.c
  166. http-fetch.c
  167. http-push.c
  168. http-walker.c
  169. http.c
  170. http.h
  171. ident.c
  172. imap-send.c
  173. INSTALL
  174. khash.h
  175. kwset.c
  176. kwset.h
  177. levenshtein.c
  178. levenshtein.h
  179. LGPL-2.1
  180. line-log.c
  181. line-log.h
  182. line-range.c
  183. line-range.h
  184. list-objects.c
  185. list-objects.h
  186. list.h
  187. ll-merge.c
  188. ll-merge.h
  189. lockfile.c
  190. lockfile.h
  191. log-tree.c
  192. log-tree.h
  193. mailinfo.c
  194. mailinfo.h
  195. mailmap.c
  196. mailmap.h
  197. Makefile
  198. match-trees.c
  199. merge-blobs.c
  200. merge-blobs.h
  201. merge-recursive.c
  202. merge-recursive.h
  203. merge.c
  204. mergesort.c
  205. mergesort.h
  206. name-hash.c
  207. notes-cache.c
  208. notes-cache.h
  209. notes-merge.c
  210. notes-merge.h
  211. notes-utils.c
  212. notes-utils.h
  213. notes.c
  214. notes.h
  215. object.c
  216. object.h
  217. pack-bitmap-write.c
  218. pack-bitmap.c
  219. pack-bitmap.h
  220. pack-check.c
  221. pack-objects.c
  222. pack-objects.h
  223. pack-revindex.c
  224. pack-revindex.h
  225. pack-write.c
  226. pack.h
  227. pager.c
  228. parse-options-cb.c
  229. parse-options.c
  230. parse-options.h
  231. patch-delta.c
  232. patch-ids.c
  233. patch-ids.h
  234. path.c
  235. pathspec.c
  236. pathspec.h
  237. pkt-line.c
  238. pkt-line.h
  239. preload-index.c
  240. pretty.c
  241. prio-queue.c
  242. prio-queue.h
  243. progress.c
  244. progress.h
  245. prompt.c
  246. prompt.h
  247. quote.c
  248. quote.h
  249. reachable.c
  250. reachable.h
  251. read-cache.c
  252. README.md
  253. ref-filter.c
  254. ref-filter.h
  255. reflog-walk.c
  256. reflog-walk.h
  257. refs.c
  258. refs.h
  259. remote-curl.c
  260. remote-testsvn.c
  261. remote.c
  262. remote.h
  263. replace_object.c
  264. rerere.c
  265. rerere.h
  266. resolve-undo.c
  267. resolve-undo.h
  268. revision.c
  269. revision.h
  270. run-command.c
  271. run-command.h
  272. send-pack.c
  273. send-pack.h
  274. sequencer.c
  275. sequencer.h
  276. server-info.c
  277. setup.c
  278. sh-i18n--envsubst.c
  279. sha1-array.c
  280. sha1-array.h
  281. sha1-lookup.c
  282. sha1-lookup.h
  283. sha1_file.c
  284. sha1_name.c
  285. shallow.c
  286. shell.c
  287. shortlog.h
  288. show-index.c
  289. sideband.c
  290. sideband.h
  291. sigchain.c
  292. sigchain.h
  293. split-index.c
  294. split-index.h
  295. strbuf.c
  296. strbuf.h
  297. streaming.c
  298. streaming.h
  299. string-list.c
  300. string-list.h
  301. submodule-config.c
  302. submodule-config.h
  303. submodule.c
  304. submodule.h
  305. symlinks.c
  306. tag.c
  307. tag.h
  308. tar.h
  309. tempfile.c
  310. tempfile.h
  311. thread-utils.c
  312. thread-utils.h
  313. trace.c
  314. trace.h
  315. trailer.c
  316. trailer.h
  317. transport-helper.c
  318. transport.c
  319. transport.h
  320. tree-diff.c
  321. tree-walk.c
  322. tree-walk.h
  323. tree.c
  324. tree.h
  325. unicode_width.h
  326. unimplemented.sh
  327. unix-socket.c
  328. unix-socket.h
  329. unpack-trees.c
  330. unpack-trees.h
  331. update_unicode.sh
  332. upload-pack.c
  333. url.c
  334. url.h
  335. urlmatch.c
  336. urlmatch.h
  337. usage.c
  338. userdiff.c
  339. userdiff.h
  340. utf8.c
  341. utf8.h
  342. varint.c
  343. varint.h
  344. version.c
  345. version.h
  346. versioncmp.c
  347. walker.c
  348. walker.h
  349. wildmatch.c
  350. wildmatch.h
  351. worktree.c
  352. worktree.h
  353. wrap-for-bin.sh
  354. wrapper.c
  355. write_or_die.c
  356. ws.c
  357. wt-status.c
  358. wt-status.h
  359. xdiff-interface.c
  360. xdiff-interface.h
  361. zlib.c
README.md

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from http://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.txt (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just “subscribe git” in the body to majordomo@vger.kernel.org. The mailing list archives are available at http://news.gmane.org/gmane.comp.version-control.git/, http://marc.info/?l=git and other archival sites.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks