Command "git credential-manager-core diagnose" fails Networking diagnostic when used with NTLM proxy #927
Labels
bug
A bug in Git Credential Manager
network
Related to networking (VPN, TCP/IP, etc)
platform:windows
Specific to the Windows platform
Which version of GCM are you using?
From a terminal, run
git credential-manager-core --version
and paste the output.2.0.785+6074e4e3d3
Problem description
I am on a Windows 10 corporate computer behind a proxy that uses NTLM authentication.
My .gitconfig file has a configuration like this, that is, with empty credentials:
Commands such as the following work as expected showing the browser window to authenticate:
So far so good. That works (as expected) because credential-manager-core, when gitconfig has empty credentials internally creates an instance of
WebProxy
withUseDefaultCredentials = true
. See:https://github.com/GitCredentialManager/git-credential-manager/blob/main/src/shared/Core/HttpClientFactory.cs#L240-L243
However, when I run this command:
Expected behavior
No exception, all (seven) diagnostics should pass.
Actual behavior
The Networking diagnostic fails because it requests proxy authentication (message translated to English):
Root cause
The root cause is that the Networking diagnostic creates a
rawHttpClient = new HttpClient()
without proxy, whose call fails and returns:https://github.com/GitCredentialManager/git-credential-manager/blob/main/src/shared/Core/Diagnostics/NetworkingDiagnostic.cs#L30-L33
and there is another bug a few lines later: the
contextHttpClient = _httpFactory.CreateClient()
, who is created with proxy and that would succeed, is never used, the code of the call usesrawHttpClient
again:https://github.com/GitCredentialManager/git-credential-manager/blob/main/src/shared/Core/Diagnostics/NetworkingDiagnostic.cs#L37-L40
The text was updated successfully, but these errors were encountered: