git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Masaya Suzuki <masayasuzuki@google.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] credential: add nocache option to the credentials API
Date: Mon, 22 Jul 2019 17:00:38 -0400	[thread overview]
Message-ID: <20190722210037.GA31664@sigill.intra.peff.net> (raw)
In-Reply-To: <CAJB1erXRg4S-vzRZwA-Q5cXAPayRE0dAjFjjkNQ9CoKiXF=7EQ@mail.gmail.com>

On Mon, Jul 22, 2019 at 10:30:52AM -0700, Masaya Suzuki wrote:

> > In that patch, I essentially proposed making all gathered credentials as
> > nocache. That's a more secure default (though in some cases less
> > convenient).
> >
> > It did break a case Shawn had of caching the result of another helper. I
> > showed some options there for providing a mechanism to chain helpers
> > together explicitly.
> 
> I think that it's better to make it nocache by default. Having one
> helper produce a credential and having another cache it looks storage.
> But since this is the current behavior, I'm OK with just keeping
> nocache an option. It's backward compatible.

Yeah, I think that make sense.

> > We also discussed helpers passing out an explicit ttl. That's a more
> > general case of your nocache flag (i.e., ttl=0 covers that case, but we
> > could additionally pass "ttl" to the cache helper to let it be smarter).
> 
> TTL sounds like it's a generalized version. It might be a bit awkward
> because the existing credential helpers that don't support TTL would
> anyway cache the credentials. I think in practice the password saving
> feature is mainly used by those password management software (like
> git-credential-osxkeychain), and they wouldn't support a short-lived
> credential. Just having nocache seems fine to me. As you said, if
> needed, "ttl" can be added and "nocache" can be just a shorthand of
> "ttl=0".

I was thinking that Git itself could treat "ttl=0" specially, the same
as your nocache, and avoid passing it along to any helpers during the
approve stage. That would make it exactly equivalent to your patch
(modulo the name change).

> > Here we're disallowing a "nocache" credential from being passed to _any_
> > helper, whether it's caching or not. It could be storing permanently,
> > though perhaps that's semantic nitpicking (if it's not to be cached, it
> > probably shouldn't be stored permanently either). Other helpers could in
> > theory be doing something else with the data, though in practice I doubt
> > here are any uses beyond debugging.
> 
> I cannot think of a usage either. If there's a good usage, I would
> change this, but if it's for debugging, it's better to be done with
> those debugging features (like GIT_TRACE_CURL). Note that this is
> called only when the credential is successfully used. We probably want
> to use such debugging feature for the credentials that are not
> successfully used.

Yeah, I don't think debugging is worth caring about here. As you say, we
can dump the data readily through other means. I was more wondering if
there was some legitimate use where a helper wanted to see (but not
store!) an existing credential. But again, I don't know of one.

And as you noted above, if we don't suppress the helper calls inside
Git, then every matching storage helper needs to learn about "nocache"
(or "ttl") before it will do any good.

-Peff

  reply	other threads:[~2019-07-22 21:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-07  5:51 [PATCH] credential: add nocache option to the credentials API Masaya Suzuki
2019-07-09 12:56 ` Jeff King
2019-07-22 17:30   ` Masaya Suzuki
2019-07-22 21:00     ` Jeff King [this message]
2019-08-26 16:27       ` Junio C Hamano
2019-09-15 21:50         ` Masaya Suzuki

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190722210037.GA31664@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=masayasuzuki@google.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).