From: Dennis Kaarsemaker <dennis.kaarsemaker@booking.com>
To: Elliott Cable <me@ell.io>, Git Mailing List <git@vger.kernel.org>,
bmwill@google.com, peff@peff.net
Subject: Re: persistent-https, url insteadof, and `git submodule`
Date: Fri, 19 May 2017 23:55:34 +0200 [thread overview]
Message-ID: <1495230934.19473.10.camel@booking.com> (raw)
In-Reply-To: <1495230186.19473.7.camel@kaarsemaker.net>
On Fri, 2017-05-19 at 23:43 +0200, Dennis Kaarsemaker wrote:
> On Fri, 2017-05-19 at 14:57 -0500, Elliott Cable wrote:
> > Set up `persistent-https` as described in the [README][]; including the
> > ‘rewrite https urls’ feature in `.gitconfig`:
> >
> > [url "persistent-https"]
> > insteadof = https
> > [url "persistent-http"]
> > insteadof = http
> >
> > Unfortunately, this breaks `git submodule add`:
> >
> > > git submodule add https://github.com/nodenv/nodenv.git \
> > ./Vendor/nodenv
> > Cloning into '/Users/ec/Library/System Repo/Vendor/nodenv'...
> > fatal: transport 'persistent-https' not allowed
> > fatal: clone of 'https://github.com/nodenv/nodenv.git' into
> > submodule path '/Users/ec/Library/System Repo/Vendor/nodenv' failed
> >
> > Presumably this isn't intended behaviour?
>
> It actually is. git-submodule sets GIT_PROTOCOL_FROM_USER to 0, which
> makes git not trust any urls except http(s), git, ssh and file urls
> unless you explicitely configure git to allow it. See the
> GIT_ALLOW_PROTOCOL section in man git and the git-config section it
> links to.
33cfccbbf3 (submodule: allow only certain protocols for submodule
fetches, 2015-09-16) says:
submodule: allow only certain protocols for submodule fetches
Some protocols (like git-remote-ext) can execute arbitrary
code found in the URL. The URLs that submodules use may come
from arbitrary sources (e.g., .gitmodules files in a remote
repository). Let's restrict submodules to fetching from a
known-good subset of protocols.
Note that we apply this restriction to all submodule
commands, whether the URL comes from .gitmodules or not.
This is more restrictive than we need to be; for example, in
the tests we run:
git submodule add ext::...
which should be trusted, as the URL comes directly from the
command line provided by the user. But doing it this way is
simpler, and makes it much less likely that we would miss a
case. And since such protocols should be an exception
(especially because nobody who clones from them will be able
to update the submodules!), it's not likely to inconvenience
anyone in practice.
D.
next prev parent reply other threads:[~2017-05-19 22:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 19:57 persistent-https, url insteadof, and `git submodule` Elliott Cable
2017-05-19 21:43 ` Dennis Kaarsemaker
2017-05-19 21:55 ` Dennis Kaarsemaker [this message]
2017-05-20 7:07 ` Jeff King
2017-05-26 16:22 ` Elliott Cable
2017-05-31 4:50 ` Jeff King
2017-05-31 14:23 ` Ævar Arnfjörð Bjarmason
2017-05-31 21:22 ` Jeff King
2017-05-31 5:18 ` [PATCH] docs/config: mention protocol implications of url.insteadOf Jeff King
2017-06-01 0:15 ` Brandon Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1495230934.19473.10.camel@booking.com \
--to=dennis.kaarsemaker@booking.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=me@ell.io \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).