git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Matthew Cheetham <mjcheetham@github.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	"lilinchao@oschina.cn" <lilinchao@oschina.cn>
Cc: Derrick Stolee <stolee@gmail.com>, git <git@vger.kernel.org>,
	Jeff King <peff@peff.net>
Subject: Re: [QUESTION]Is it possible that git would support two-factor authentication?
Date: Tue, 17 Aug 2021 11:19:53 +0100	[thread overview]
Message-ID: <673E5460-E431-42B9-943A-E5AF47CB4508@github.com> (raw)
In-Reply-To: <D8CFA50F-266A-4995-8058-D29A2D490D5F@github.com>

(Re-sending, this time without HTML)

Hello!

> On 14 Aug 2021, at 11:02 pm, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> 
> Hi,
> 
> On Fri, 13 Aug 2021, lilinchao@oschina.cn wrote:
> 
>>> On 8/11/2021 7:00 AM, lilinchao@oschina.cn wrote:
>>>> Many websites support two-factor authentication(2FA) to log in, like Github, I wander if we can support it in application layer.
>>>> When client clone something, they need  input username and password, it is like a website login process. For security, we can
>>>> enable  2FA during this process.
>>> 
>>> Typically, this is handled at the credential helper layer, which
>>> is a tool outside of the Git codebase that can more closely work
>>> with such 2FA/MFA requirements. For example, GCM Core [1] supports
>>> 2FA with GitHub, Azure DevOps, and BitBucket.
>>> 
>>> [1] https://github.com/microsoft/Git-Credential-Manager-Core
>>> 
>>> The mechanism is that Git attempts an operation and gets an error
>>> code, so it asks for a credential from the helper. The helper
>>> then communicates with the server to do whatever authentication
>>> is required, including possibly performing multi-factor auth.
>>> All of these details are hidden from Git, which is good.
>>> 
>> Indeed, this is good, I've experienced this tool these days at WSL and Windows,
>> but finally I hope these features can be supported by Git itself, and then the user end can easily configure it.
> 
> The problem here is that 2FA is highly provider-specific. And that's why
> Git itself refuses to implement it. Hence the credential helper layer.
> 
> Ciao,
> Johannes


Johannes and Derrick are correct. Sadly, there is no standard “modern" authentication/authorization stack that Git could support in practice.

You may think of OAuth2.0 as being a good choice, and you’d be right for the most part! However there are several shortcomings today.
Plenty of vendors implement OAuth2 in different ways (technically they’re not following RFC 6749 [1]), or have extensions to the specification that end up being required for most use.

At the same time there’s no standard discovery mechanism for the various required endpoints to avoid having the Git project “hardcode” this configuration for each provider - the Git project should be agnostic.

OpenID Connect [2] extends OAuth2 with some useful things like endpoint discovery [3], but that is also optional to implement and still requires some server-side registration and administration (that is vendor specific).

There’s also the question of user interaction. Often this is tied to specific, opinionated choices like: user agent (browser), operating system integrations, YubiKey or custom multi-factor authentication solutions (SMS? biometrics? OTP apps?).

There may be more that Git can do to surface authN/Z challenges to a credential helper (such at Git Credential Manager [4]) that might help in making auth in a post-password world less painful. The project is open to contributions to any vendor or auth stack.

[1] https://datatracker.ietf.org/doc/html/rfc6749
[2] https://openid.net/specs/openid-connect-core-1_0.html
[3] https://openid.net/specs/openid-connect-discovery-1_0.html
[4] https://aka.ms/gcmcore

Thanks,
Matthew



      parent reply	other threads:[~2021-08-17 10:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 11:00 [QUESTION]Is it possible that git would support two-factor authentication? lilinchao
2021-08-11 13:50 ` Konstantin Ryabitsev
2021-08-11 15:23   ` Theodore Ts'o
2021-08-13 22:56   ` brian m. carlson
2021-08-11 13:54 ` Derrick Stolee
     [not found] ` <9b199de2faab11eba548a4badb2c2b1195555@gmail.com>
2021-08-13  7:49   ` lilinchao
2021-08-14 22:02     ` Johannes Schindelin
     [not found]       ` <BEBB4A79-9773-4701-A8C5-06C20AB42686@github.com>
     [not found]         ` <1F2C610F-8800-466A-A0CA-7A6068A14805@github.com>
     [not found]           ` <D8CFA50F-266A-4995-8058-D29A2D490D5F@github.com>
2021-08-17 10:19             ` Matthew Cheetham [this message]

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=673E5460-E431-42B9-943A-E5AF47CB4508@github.com \
    --to=mjcheetham@github.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=lilinchao@oschina.cn \
    --cc=peff@peff.net \
    --cc=stolee@gmail.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).