git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] credential: do not store credentials received from helpers

From
Shawn Pearce <spearce@spearce.org>
Date
Apr 7, 2012, 04:12 UTC
Message-ID
<CAJo=hJvqQ0CgCga4va3ZX+XV5DWc1kWS5v4vYWkEzRYT5+p+cg@mail.gmail.com>
In-Reply-To
<20120407033417.GA13914@sigill.intra.peff.net>
On Fri, Apr 6, 2012 at 20:34, Jeff King <peff@peff.net> wrote:
Show 10 quoted lines
>  2. If you use a time-based storage helper like
>     "git-credential-cache", every time you run a git
>     command which uses the credential, it will also
>     re-insert the credential after use, freshening the
>     cache timestamp. So the cache will eventually expire N
>     time units after the last _use_, not after the time the
>     user actually typed the password. This is probably not
>     what most users expect or want (and if they do, we
>     should do it explicitly by providing an option to
>     refresh the timestamp on use).

So if I use the cache helper, and its set to expire at the default of 15 minutes, I have to type my password in every 15 minutes, even if I am doing a Git operation roughly every 8 minutes during a work day?

Show 7 quoted lines
> We can solve this by marking a credential that comes from a
> helper, so we don't bother feeding it back to the helpers.
> The credential struct already has an "approved" flag so
> that we try to store it only once, rather than for each
> successful http request. We can use the same flag to
> "pre-approve" a credential which comes from a helper, and
> enver try to store it at all.
This breaks one of my credential helpers.

I have a helper that generates a password by asking a remote system to generate a short lived password based on other authentication systems that I can't describe. Once I have that password, its good for $X time.

The helper just dumps it out to Git, and Git turns around and stores it into the cache for me. This means later requests will keep that credential in the cache, and avoid making that remote system call every time I do a Git network command. I guess I now need to change my helper to cache git credential-cache itself and store the password into the cache if it wants to use the cache?

Should we update the credential helper documentation at the same time as this change to make it clear Git won't cache passwords returned from helpers, but a helper could call the credential-cache itself if it wanted to reuse the existing cache service?

Previous: Jeff KingNext: Jeff King
Message 2 of 10 in “credential: do not store credentials received from helpers”
  1. credential: do not store credentials received from helpersJeff King, Apr 7, 2012
  2. Shawn PearceApr 7, 2012
  3. Jeff KingApr 7, 2012
  4. Jeff KingApr 7, 2012
  5. Junio C HamanoApr 7, 2012
  6. Jeff KingApr 7, 2012
  7. Junio C HamanoApr 8, 2012
  8. Jeff KingApr 8, 2012
  9. Jeff KingApr 8, 2012
  10. Jeff KingApr 8, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.