1
0
mirror of https://github.com/git/git.git synced 2024-10-22 12:28:32 +02:00
git/Documentation
Jeff King 50d3413740 http: make redirects more obvious
We instruct curl to always follow HTTP redirects. This is
convenient, but it creates opportunities for malicious
servers to create confusing situations. For instance,
imagine Alice is a git user with access to a private
repository on Bob's server. Mallory runs her own server and
wants to access objects from Bob's repository.

Mallory may try a few tricks that involve asking Alice to
clone from her, build on top, and then push the result:

  1. Mallory may simply redirect all fetch requests to Bob's
     server. Git will transparently follow those redirects
     and fetch Bob's history, which Alice may believe she
     got from Mallory. The subsequent push seems like it is
     just feeding Mallory back her own objects, but is
     actually leaking Bob's objects. There is nothing in
     git's output to indicate that Bob's repository was
     involved at all.

     The downside (for Mallory) of this attack is that Alice
     will have received Bob's entire repository, and is
     likely to notice that when building on top of it.

  2. If Mallory happens to know the sha1 of some object X in
     Bob's repository, she can instead build her own history
     that references that object. She then runs a dumb http
     server, and Alice's client will fetch each object
     individually. When it asks for X, Mallory redirects her
     to Bob's server. The end result is that Alice obtains
     objects from Bob, but they may be buried deep in
     history. Alice is less likely to notice.

Both of these attacks are fairly hard to pull off. There's a
social component in getting Mallory to convince Alice to
work with her. Alice may be prompted for credentials in
accessing Bob's repository (but not always, if she is using
a credential helper that caches). Attack (1) requires a
certain amount of obliviousness on Alice's part while making
a new commit. Attack (2) requires that Mallory knows a sha1
in Bob's repository, that Bob's server supports dumb http,
and that the object in question is loose on Bob's server.

But we can probably make things a bit more obvious without
any loss of functionality. This patch does two things to
that end.

First, when we encounter a whole-repo redirect during the
initial ref discovery, we now inform the user on stderr,
making attack (1) much more obvious.

Second, the decision to follow redirects is now
configurable. The truly paranoid can set the new
http.followRedirects to false to avoid any redirection
entirely. But for a more practical default, we will disallow
redirects only after the initial ref discovery. This is
enough to thwart attacks similar to (2), while still
allowing the common use of redirects at the repository
level. Since c93c92f30 (http: update base URLs when we see
redirects, 2013-09-28) we re-root all further requests from
the redirect destination, which should generally mean that
no further redirection is necessary.

As an escape hatch, in case there really is a server that
needs to redirect individual requests, the user can set
http.followRedirects to "true" (and this can be done on a
per-server basis via http.*.followRedirects config).

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-06 12:32:48 -08:00
..
howto new-command.txt: correct the command description file 2016-06-27 06:11:57 -07:00
RelNotes Prepare for 2.9.4 2016-09-08 21:37:59 -07:00
technical Merge branch 'ls/packet-line-protocol-doc-fix' into maint 2016-09-08 21:35:57 -07:00
.gitattributes
.gitignore
asciidoc.conf
blame-options.txt
build-docdep.perl
cat-texi.perl
cmd-list.perl
CodingGuidelines CodingGuidelines: formatting HEAD in documentation 2016-06-28 08:36:45 -07:00
config.txt http: make redirects more obvious 2016-12-06 12:32:48 -08:00
date-formats.txt doc: more consistency in environment variables format 2016-06-08 12:04:37 -07:00
diff-config.txt Merge branch 'mm/doc-tt' into maint 2016-07-28 11:25:54 -07:00
diff-format.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
diff-generate-patch.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
diff-options.txt Merge branch 'jc/doc-diff-filter-exclude' into maint 2016-08-08 14:21:44 -07:00
docbook-xsl.css
docbook.xsl
everyday.txto
fetch-options.txt Merge branch 'mm/doc-tt' into maint 2016-07-28 11:25:54 -07:00
fix-texi.perl
fmt-merge-msg-config.txt
git-add.txt
git-am.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-annotate.txt
git-apply.txt
git-archimport.txt
git-archive.txt
git-bisect-lk2009.txt doc: more consistency in environment variables format 2016-06-08 12:04:37 -07:00
git-bisect.txt doc: typeset HEAD and variants as literal 2016-06-28 08:36:45 -07:00
git-blame.txt
git-branch.txt doc: typeset HEAD and variants as literal 2016-06-28 08:36:45 -07:00
git-bundle.txt
git-cat-file.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-check-attr.txt
git-check-ignore.txt
git-check-mailmap.txt
git-check-ref-format.txt
git-checkout-index.txt
git-checkout.txt doc: typeset short command-line options as literal 2016-06-28 08:20:52 -07:00
git-cherry-pick.txt Merge branch 'mm/doc-tt' into maint 2016-07-28 11:25:54 -07:00
git-cherry.txt
git-citool.txt
git-clean.txt doc: typeset short command-line options as literal 2016-06-28 08:20:52 -07:00
git-clone.txt Merge branch 'sb/clone-shallow-passthru' into maint 2016-07-11 10:44:12 -07:00
git-column.txt
git-commit-tree.txt Merge branch 'mm/doc-tt' into maint 2016-07-28 11:25:54 -07:00
git-commit.txt Merge branch 'mm/doc-tt' into maint 2016-07-28 11:25:54 -07:00
git-config.txt Merge branch 'dg/document-git-c-in-git-config-doc' into maint 2016-09-08 21:35:56 -07:00
git-count-objects.txt
git-credential-cache--daemon.txt
git-credential-cache.txt
git-credential-store.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-credential.txt
git-cvsexportcommit.txt
git-cvsimport.txt doc: typeset HEAD and variants as literal 2016-06-28 08:36:45 -07:00
git-cvsserver.txt doc: typeset HEAD and variants as literal 2016-06-28 08:36:45 -07:00
git-daemon.txt doc: typeset HEAD and variants as literal 2016-06-28 08:36:45 -07:00
git-describe.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-diff-files.txt
git-diff-index.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-diff-tree.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-diff.txt
git-difftool.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-fast-export.txt
git-fast-import.txt doc: typeset '--' as literal 2016-06-28 08:36:45 -07:00
git-fetch-pack.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-fetch.txt
git-filter-branch.txt doc: typeset '--' as literal 2016-06-28 08:36:45 -07:00
git-fmt-merge-msg.txt
git-for-each-ref.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-format-patch.txt Merge branch 'tr/doc-tt' into maint 2016-07-06 13:06:34 -07:00
git-fsck-objects.txt
git-fsck.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-gc.txt doc: change configuration variables format 2016-06-08 12:04:55 -07:00
git-get-tar-commit-id.txt
git-grep.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-gui.txt doc: typeset HEAD and variants as literal 2016-06-28 08:36:45 -07:00
git-hash-object.txt
git-help.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-http-backend.txt doc: more consistency in environment variables format 2016-06-08 12:04:37 -07:00
git-http-fetch.txt
git-http-push.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-imap-send.txt
git-index-pack.txt
git-init-db.txt
git-init.txt Merge branch 'tr/doc-tt' into maint 2016-07-06 13:06:34 -07:00
git-instaweb.txt doc: change configuration variables format 2016-06-08 12:04:55 -07:00
git-interpret-trailers.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-log.txt Merge branch 'tr/doc-tt' into maint 2016-07-06 13:06:34 -07:00
git-ls-files.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-ls-remote.txt
git-ls-tree.txt doc: typeset HEAD and variants as literal 2016-06-28 08:36:45 -07:00
git-mailinfo.txt Merge branch 'va/mailinfo-doc-typofix' into maint 2016-05-26 13:17:14 -07:00
git-mailsplit.txt
git-merge-base.txt
git-merge-file.txt
git-merge-index.txt
git-merge-one-file.txt
git-merge-tree.txt
git-merge.txt
git-mergetool--lib.txt
git-mergetool.txt
git-mktag.txt
git-mktree.txt doc: typeset short command-line options as literal 2016-06-28 08:20:52 -07:00
git-mv.txt doc: typeset short command-line options as literal 2016-06-28 08:20:52 -07:00
git-name-rev.txt
git-notes.txt doc: typeset short command-line options as literal 2016-06-28 08:20:52 -07:00
git-p4.txt Merge branch 'mm/doc-tt' into maint 2016-07-28 11:25:54 -07:00
git-pack-objects.txt document git-repack interaction of pack.threads and pack.windowMemory 2016-08-10 10:55:13 -07:00
git-pack-redundant.txt
git-pack-refs.txt
git-parse-remote.txt
git-patch-id.txt
git-prune-packed.txt
git-prune.txt
git-pull.txt
git-push.txt Merge branch 'jk/push-force-with-lease-creation' into maint 2016-09-08 21:35:53 -07:00
git-quiltimport.txt doc: more consistency in environment variables format 2016-06-08 12:04:37 -07:00
git-read-tree.txt
git-rebase.txt Merge branch 'mm/doc-tt' into maint 2016-07-28 11:25:54 -07:00
git-receive-pack.txt
git-reflog.txt
git-relink.txt
git-remote-ext.txt
git-remote-fd.txt
git-remote-helpers.txto
git-remote-testgit.txt
git-remote.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-repack.txt document git-repack interaction of pack.threads and pack.windowMemory 2016-08-10 10:55:13 -07:00
git-replace.txt doc: change environment variables format 2016-06-08 12:04:37 -07:00
git-request-pull.txt
git-rerere.txt
git-reset.txt
git-rev-list.txt
git-rev-parse.txt
git-revert.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-rm.txt
git-send-email.txt Merge branch 'mm/doc-tt' into maint 2016-07-28 11:25:54 -07:00
git-send-pack.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-sh-i18n--envsubst.txt
git-sh-i18n.txt
git-sh-setup.txt doc: more consistency in environment variables format 2016-06-08 12:04:37 -07:00
git-shell.txt doc: typeset short command-line options as literal 2016-06-28 08:20:52 -07:00
git-shortlog.txt
git-show-branch.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-show-index.txt
git-show-ref.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-show.txt
git-stage.txt
git-stash.txt
git-status.txt
git-stripspace.txt
git-submodule.txt
git-svn.txt Merge branch 'mm/doc-tt' into maint 2016-07-28 11:25:54 -07:00
git-symbolic-ref.txt
git-tag.txt Merge branch 'mm/doc-tt' into maint 2016-07-28 11:25:54 -07:00
git-tools.txt
git-unpack-file.txt
git-unpack-objects.txt
git-update-index.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-update-ref.txt
git-update-server-info.txt
git-upload-archive.txt
git-upload-pack.txt
git-var.txt
git-verify-commit.txt Merge branch 'dn/gpg-doc' into maint 2016-07-06 13:06:36 -07:00
git-verify-pack.txt
git-verify-tag.txt
git-web--browse.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
git-whatchanged.txt
git-worktree.txt
git-write-tree.txt
git.txt Git 2.9.3 2016-08-12 09:17:51 -07:00
gitattributes.txt Merge branch 'jc/renormalize-merge-kill-safer-crlf' into maint 2016-09-08 21:35:52 -07:00
gitcli.txt
gitcore-tutorial.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
gitcredentials.txt
gitcvs-migration.txt
gitdiffcore.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
giteveryday.txt
gitglossary.txt
githooks.txt
gitignore.txt doc: change configuration variables format 2016-06-08 12:04:55 -07:00
gitk.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
gitmodules.txt doc: typeset long command-line options as literal 2016-06-28 08:36:45 -07:00
gitnamespaces.txt
gitremote-helpers.txt doc: typeset HEAD and variants as literal 2016-06-28 08:36:45 -07:00
gitrepository-layout.txt
gitrevisions.txt
gittutorial-2.txt
gittutorial.txt
gitweb.conf.txt doc: more consistency in environment variables format 2016-06-08 12:04:37 -07:00
gitweb.txt doc: change environment variables format 2016-06-08 12:04:37 -07:00
gitworkflows.txt
glossary-content.txt Merge branch 'rn/glossary-typofix' into HEAD 2016-05-18 14:40:14 -07:00
howto-index.sh
i18n.txt
install-doc-quick.sh
install-webdoc.sh
line-range-format.txt
lint-gitlink.perl
mailmap.txt
Makefile Documentation/technical: describe signature formats 2016-06-17 11:39:05 -07:00
manpage-1.72.xsl
manpage-base-url.xsl.in
manpage-base.xsl
manpage-bold-literal.xsl
manpage-normal.xsl
manpage-quote-apos.xsl
manpage-suppress-sp.xsl
merge-config.txt doc: change environment variables format 2016-06-08 12:04:37 -07:00
merge-options.txt
merge-strategies.txt
pretty-formats.txt doc/pretty-formats: explain shortening of %gd 2016-07-22 13:47:33 -07:00
pretty-options.txt Merge branch 'tr/doc-tt' into maint 2016-07-06 13:06:34 -07:00
pull-fetch-param.txt
rev-list-options.txt Merge branch 'jk/reflog-date' into maint 2016-09-08 21:35:52 -07:00
revisions.txt doc: typeset HEAD and variants as literal 2016-06-28 08:36:45 -07:00
sequencer.txt
SubmittingPatches SubmittingPatches: use gitk's "Copy commit summary" format 2016-08-26 15:58:10 -07:00
urls-remotes.txt
urls.txt
user-manual.conf
user-manual.txt