git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Antoine Pelisse <apelisse@gmail.com>, git <git@vger.kernel.org>,
	Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: contrib/credential/netrc/git-credential-netrc: Use of uninitialized value in string
Date: Tue, 27 Aug 2013 16:05:51 -0400	[thread overview]
Message-ID: <20130827200550.GA17443@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqr4dfhjmg.fsf@gitster.dls.corp.google.com>

On Mon, Aug 26, 2013 at 08:56:23PM -0700, Junio C Hamano wrote:

> Antoine Pelisse <apelisse@gmail.com> writes:
> 
> > I've tried to use the netrc credential with git-send-email
> > (v1.8.4-rc2), and I've had the following log (running with -d -v):
> 
> Peff what do you think?  From credential layer's point of view, I
> think we make it totally up to the helper to decide if a request
> matches what it supports, and if a particular helper wants to make
> sure it is asked for a specific protocol, that is an OK thing to do,
> but it feels unnecessarily unfriendly and treating missing proto
> specification as a wildcard to talk to the specified host over any
> protocol may not hurt, I would think.

Right. It is up to the credential helper to map git's request into
whatever storage it has. So I think the right answer is whatever is
normal and expected for netrc.

Unfortunately that is not really a standardized format. The original
netrc was ftp-only, and did not have a port or protocol field at all.
Programs like curl extend it automatically to http, and just googling
around seems to show other programs using it for imap and smtp. So I
think there is some precedence in simply treating a missing "port" field
as "match any port/protocol" on the machine.

The upside is that it is convenient for the user. The downside is that
we might accidentally send a password to a service that the user does
not expect, which could compromise security. It would at least be on the
matching host, but the protocol might not be as secure as the one the
user intended (e.g., smtp without starttls, when the password was meant
to only go over imap-over-ssl).

So I'm on the fence. It is very unlikely to be a bad thing, but if it
is, it may expose user passwords in cleartext. If we are going to keep
the current behavior, it probably needs to be documented, and certainly:

> > Use of uninitialized value $_[2] in printf at
> > /home/antoine/code/git/contrib/credential/netrc/git-credential-netrc
> > line 419.
> > compare protocol [] to [smtp] (entry: password=secret,
> > username=apelisse@gmail.com, host=smtp.gmail.com:587)
> > Use of uninitialized value in string eq at
> > /home/antoine/code/git/contrib/credential/netrc/git-credential-netrc
> > line 378.

...these should more cleanly handle the missing field.

-Peff

  reply	other threads:[~2013-08-27 20:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-24 14:55 contrib/credential/netrc/git-credential-netrc: Use of uninitialized value in string Antoine Pelisse
2013-08-27  3:56 ` Junio C Hamano
2013-08-27 20:05   ` Jeff King [this message]
2013-09-03 15:23     ` Ted Zlatanov
2013-09-03 17:35       ` Jeff King
2013-10-08 14:34         ` Ted Zlatanov

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=20130827200550.GA17443@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=apelisse@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tzz@lifelogs.com \
    /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).