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

Re: Credential helpers are no longer invoked in case of having sub-folder parts in a repository URL. Since 2.26.1 version

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 22, 2020, 19:20 UTC
Message-ID
<nycvar.QRO.7.76.6.2004222117400.18039@tvgsbejvaqbjf.bet>
In-Reply-To
<20200422040644.GC3559880@coredump.intra.peff.net>
Hi,
On Wed, 22 Apr 2020, Jeff King wrote:
Show 41 quoted lines
> On Wed, Apr 22, 2020 at 02:20:20AM +0000, brian m. carlson wrote:
>
> > > Thanks.  Here's another (though I haven't tried bisecting yet):
> > >
> > > 	echo url='https://github.com/git/git' |
> > > 	GIT_TERMINAL_PROMPT=0 \
> > > 	git -c credential.helper= \
> > > 		-c credential.github.com.helper='!echo username=foo; echo password=bar;:' \
> > > 		credential fill
> >
> > gitcredentials(7) says the following:
> >
> >   Git considers each credential to have a context defined by a URL.
> >   This context is used to look up context-specific configuration, and is
> >   passed to any helpers, which may use it as an index into secure
> >   storage.
> >
> > I'm not sure a hostname qualifies as a URL in this case.  So while my
> > patch did break this, I don't believe it's ever been documented to
> > actually work and was an artifact of our implementation (along with
> > "credential./git/git.helper" and "credential.https://.helper").  I've
> > also never seen this syntax used in the wild, but maybe I'm not looking
> > in the right places.
>
> I'm pretty sure it was an intended use case, though it is a natural
> outcome of the credential_match() strategy of "unspecified things match
> anything". I'd suspect that anybody relying on it is doing so
> unintentionally, and just forgot to put the protocol field in. Though I
> suppose doing so would let you cover http/https in a single block.
>
> At any rate, even in versions _without_ your patch, that became a hard
> error in this week's release. In v2.24.3, for example:
>
>   $ echo url=https://anyhost.example.com |
>     git -c credential.example.com.username=foo credential fill
>   warning: url has no scheme: example.com
>   fatal: credential url cannot be parsed: example.com
>
> because we're relying there on credential_from_url() to parse the config
> credentials, too. After your patch, we use the http-config machinery,
> which simply doesn't match.

This affects also pre-v2.26.* versions. One fallout is that some GitHub Desktop users reported that they cannot fetch anymore: https://github.com/desktop/desktop/issues/9597

I _think_ I have a good fix for this, and am only waiting for the PR builds at https://github.com/gitgitgadget/git/pull/615 to finish before I will submit that patch series for review.

Ideally, I will integrate these patches into some MinGit backports tonight, still, so that GitHub Desktop can roll out another release to avoid many more reports. Therefore, I hope for quick reviews ;-)

Ciao, Dscho

Show 16 quoted lines
>
> > I don't think we can shoehorn it into urlmatch, since that would break
> > compatibility with the `http.*` config options, so I think we'd have to
> > revert the entire feature if we want to preserve it.  I think I'd prefer
> > to leave things as it is since it seems uncommon and there are easy
> > alternatives, but if folks prefer, I can send a patch to revert the
> > urlmatch feature.
>
> I agree that we should leave it. Aside from the dual http/https thing
> (which _hopefully_ is rare these days as https become more of a
> standard), I don't think it has a legitimate use case. And I think we
> should be pushing users to be a bit more careful with their url config.
>
> -Peff
>
>
Previous: Jeff KingNext: brian m. carlson
Message 8 of 20 in “Credential helpers are no longer invoked in case of having sub-folder parts in a repository URL. Since 2.26.1 version”
  1. Ilya TretyakovApr 21, 2020
  2. Jeff KingApr 21, 2020
  3. brian m. carlsonApr 22, 2020
  4. Jonathan NiederApr 22, 2020
  5. Jeff KingApr 22, 2020
  6. brian m. carlsonApr 22, 2020
  7. Jeff KingApr 22, 2020
  8. Johannes SchindelinApr 22, 2020
  9. credential: fix matching URLs with multiple levels in pathbrian m. carlson, Apr 22, 2020
  10. Jeff KingApr 22, 2020
  11. brian m. carlsonApr 22, 2020
  12. credential: fix matching URLs with multiple levels in pathbrian m. carlson, Apr 22, 2020
  13. Jeff KingApr 22, 2020
  14. Carlo Marcelo Arenas BelónApr 24, 2020
  15. Junio C HamanoApr 24, 2020
  16. redential: fix matching URLs with multiple levels in pathbrian m. carlson, Apr 25, 2020
  17. Eric SunshineApr 26, 2020
  18. credential: fix matching URLs with multiple levels in pathbrian m. carlson, Apr 26, 2020
  19. credential: fix matching URLs with multiple levels in pathbrian m. carlson, Apr 27, 2020
  20. Junio C HamanoApr 27, 2020

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.