git-ecosystem / git-ecosystem/git-credential-manager

Credential protocol enhancement: Retry mechanism and stateful operations

Open
#2,057 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement gcm3.0
Dominant language
C#
Stars
9.3k
Forks
2.9k
Avg merge
7d 1h
Merged PRs (30d)
14

Description

The Git credential protocol is really a set of three commands that credential helpers (such as GCM) should implement: get, store, and erase. The credential helpers are run with these commands as separate processes at different points of the overall Git remote operation, such as fetch or push.

Starting in Git version 2.46 the protocol now supports persisting state between get + store/erase command pairs. Since each credential helper command is invoked as a new process, it was previously not possible to persist metadata between calls. Examples of state that we may wish to keep are options to 'remember this account' to help with multi-account scenarios or maintain other caches of dynamically resolved information. 

Also starting in version 2.46, the protocol added the ability to advertise a multi-stage authentication process using the continue protocol key. This lets Git know that if a subsequent HTTP 401 response is encountered following an authenticated HTTP request, that this is not the end of the operation, and that the credential helper should be consulted once more. 

Using both the continue and state[] protocol capabilities, GCM will be able to perform optimistic account selection in the case of multiple accounts, or an available OS/broker account in the case of MSAL-based authentication. Without the ability to 'retry', selecting the wrong account means GCM doesn't get the opportunity to present an account selection, nor to understand that its previous 'best guess' was incorrect.

Author: @mjcheetham

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Git 2.46's credential protocol changes for the continue and state[] capabilities, then inspect how the credential helper handles separate get, store, and erase processes. Define the retry and stateful-operation behavior for GCM, including multi-account authentication, and add coverage demonstrating that a failed account selection can trigger another authentication attempt.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
authentication
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.