From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Owen Taylor <otaylor@redhat.com>,
git@vger.kernel.org, Colin Walters <walters@verbum.org>
Subject: Re: git push --confirm ?
Date: Sun, 13 Sep 2009 06:52:47 -0400 [thread overview]
Message-ID: <20090913105247.GA21750@coredump.intra.peff.net> (raw)
In-Reply-To: <7vljkjuo43.fsf@alter.siamese.dyndns.org>
On Sun, Sep 13, 2009 at 03:37:32AM -0700, Junio C Hamano wrote:
> With --confirm, the wait happens while the --confirm waits for the human,
> and perhaps the command does "git log --oneline old...new" as convenience.
> While all this is happening, the TCP connection to the remote end is still
> kept open. We do not lock anything, but if somebody else pushed from
> sideways, at the end of this session we would notice that, and the push
> will be aborted.
>
> This somewhat makes me worry about DoS point of view, but it does make it
> somewhat safer.
I don't see how it makes a DoS any worse. A malicious attacker can
always open the TCP connection and let it sit; we are changing only the
client code, after all.
It does increase the possibility of _accidentally_ wasting a TCP
connection. I don't know if that is a real-world problem or not. I would
think heavily-utilized sites might put a time-out on the connection to
avoid such a DoS in the first place.
However, such a timeout is perhaps reason for us to be concerned with
implementing this feature with a single session. Will users looking at
the commits for confirmation delay enough to hit configured timeouts,
dropping their connection and forcing them to start again?
One other way to implement this would be with two TCP connections:
1. git push --dry-run, recording <old-sha1> for each ref to be pushed.
Afterwards, drop the TCP connection.
2. Get confirmation from the user.
3. Do the push again, confirming that the <old-sha1> values sent by
the server match what we showed the user for confirmation. If not,
abort the push.
Besides being a lot more annoying to implement, there is one big
downside: in many cases the single TCP connection is a _feature_. If you
are pushing via ssh and providing a password manually, it is a
significant usability regression to have to input it twice.
Also, given that ssh is going to be by far the biggest transport for
pushing via the git protocol, I suspect any timeouts are set for
_before_ the authentication phase (i.e., SSH times you out if you don't
actually log in). So in that sense it may not be worth worrying about
how long we take during the push itself.
> I think the largest practical safety would come from the fact that this
> would make it convenient (i.e. a single command "push --confirm") than
> having to run two separate ones with manual inspection in between. A
> safety feature that is cumbersome to use won't add much to safety, as that
> is unlikely to be used in the first place.
Sure. But that is about packaging it up as a single session for the
user. If there is no concern about atomicity, you could do that with a
simple wrapper script.
-Peff
next prev parent reply other threads:[~2009-09-13 10:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-12 17:51 git push --confirm ? Owen Taylor
2009-09-12 18:43 ` Jeff King
2009-09-12 20:11 ` Owen Taylor
2009-09-12 20:49 ` Jeff King
2009-09-12 21:55 ` Daniel Barkalow
2009-09-13 0:41 ` Junio C Hamano
2009-09-13 9:33 ` Jeff King
2009-09-13 10:37 ` Junio C Hamano
2009-09-13 10:52 ` Jeff King [this message]
2009-09-13 16:59 ` Uri Okrent
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=20090913105247.GA21750@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=otaylor@redhat.com \
--cc=walters@verbum.org \
/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).