Skip to content

Load SSL certificate according to git config#512

Merged
jrbriggs merged 27 commits into
microsoft:masterfrom
turbonaitis:ssl
Feb 11, 2019
Merged

Load SSL certificate according to git config#512
jrbriggs merged 27 commits into
microsoft:masterfrom
turbonaitis:ssl

Conversation

@turbonaitis
Copy link
Copy Markdown
Contributor

This PR addresses #487.

It covers the scenarios, when sslCert configured in .gitconfig points either to a certificate with private key in a keychain, or to a file, containing both public and private keys.

One thing missing is sslKey support - if our .gitconfig specifies sslCert, containing just the public part, and sslKey, containing the private key, the current PR doesn't load it. Main reason being, is that dotnet currently does not support easy handling of PEM files. I'll create a separate PR addressing that, as I believe it will lead to much more discussins.

@msftclas
Copy link
Copy Markdown

msftclas commented Nov 19, 2018

CLA assistant check
All CLA requirements met.

@msftclas
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

❌ turbonaitis sign now
You have signed the CLA already but the status is still pending? Let us recheck it.

@turbonaitis turbonaitis force-pushed the ssl branch 2 times, most recently from 7218810 to aa9933e Compare November 19, 2018 09:12
Copy link
Copy Markdown
Member

@jrbriggs jrbriggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! A few questions.

Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs Outdated
Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs
Comment thread GVFS/GVFS.Common/Git/GitSslSettings.cs Outdated

using (ITracer activity = tracer.StartActivity("TryGetCertificatePassword", EventLevel.Informational))
{
Result gitCredentialOutput = this.InvokeGitAgainstDotGitFolder(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this on Windows?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, sadly I do not have access to a windows machine. Do you think something in particular may behave differently here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prompting for a password from potentially a background process is just a flow we don't have good automation around, which is why I was asking.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrbriggs @turbonaitis, what is the status of this discussion?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this doesn't differ from TryGetCredentials, a method you already have. It invokes the same git credential helper, with the same potential of being invoked from a background process. So the way I see it, I'm not introducing anything new here. And yes, when credentials change, while VFS4G is running, and when getting new credentials requires user interaction in terminal (be it for certificate or for http), bad things will happen, but that's something, that is already in the code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilbaker do you agree with this? Or do you think that my changes introduce some additional risks?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@turbonaitis your explanation makes sense to me. @jrbriggs is more familiar with the GCM auth flows and I'd like to hear his thoughts as well.

Comment thread GVFS/GVFS.Common/Enlistment.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitProcess.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitProcess.cs
Comment thread GVFS/GVFS.Common/Git/GitProcess.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSslSettings.cs Outdated
Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitConfigHelper.cs
Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs Outdated
Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs Outdated
@turbonaitis
Copy link
Copy Markdown
Contributor Author

@jrbriggs I think I've addressed all of the comments above. Are there any other outstanding actions, that I should take, before we can merge this PR?

Copy link
Copy Markdown
Member

@jrbriggs jrbriggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes. We're almost there. Just a couple of nits and a question.

Comment thread GVFS/GVFS.Common/Git/GitConfigSetting.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSslSettings.cs Outdated
Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs Outdated
Copy link
Copy Markdown
Member

@jrbriggs jrbriggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks for the changes.

@jrbriggs
Copy link
Copy Markdown
Member

jrbriggs commented Dec 7, 2018

There's a couple of stylecop warnings to fix.

Copy link
Copy Markdown
Member

@kewillford kewillford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions and suggested refactoring.

Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs Outdated
Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs Outdated
Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs Outdated
Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs Outdated
Comment thread GVFS/GVFS.Common/Http/HttpRequestor.cs Outdated
Copy link
Copy Markdown
Member

@kewillford kewillford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Only outstanding question for me is handling of the results of FindBySubjectName Thanks.

Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
@turbonaitis
Copy link
Copy Markdown
Contributor Author

Rebased on latest master to prevent merge-conflicts.

Comment thread GVFS/GVFS.Common/Tracing/JsonTracer.cs
Comment thread GVFS/GVFS.Common/Git/GitAuthentication.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Copy link
Copy Markdown
Member

@wilbaker wilbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questions and comments (mostly minor) after taking a first pass over the changes.

Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Http/ConfigHttpRequestor.cs Outdated
Comment thread GVFS/GVFS.UnitTests/Mock/Common/MockTracer.cs Outdated
Comment thread GVFS/GVFS.UnitTests/Common/GitConfigHelperTests.cs Outdated
Comment thread GVFS/GVFS.Common/Http/ConfigHttpRequestor.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitAuthentication.cs Outdated
Comment thread GVFS/GVFS.UnitTests/Git/GitAuthenticationTests.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs
Comment thread GVFS/GVFS.Common/Git/GitProcess.cs
Copy link
Copy Markdown
Member

@wilbaker wilbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the delay in getting to this PR. I haven't looked at the testing changes yet, but I did notice that the latest code does not compile on Windows, see comments for details.

Comment thread GVFS/GVFS.Common/GVFS.Common.csproj Outdated
Comment thread GVFS/GVFS.Common/X509Certificates/SystemCertificateStore.cs Outdated
Copy link
Copy Markdown
Member

@wilbaker wilbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added some comments on the latest changes, most of them are minor style comments.

Comment thread GVFS/GVFS.UnitTests/Common/Git/GitSslTests.cs Outdated
Comment thread GVFS/GVFS/CommandLine/CloneVerb.cs Outdated

using (ITracer activity = tracer.StartActivity("TryGetCertificatePassword", EventLevel.Informational))
{
Result gitCredentialOutput = this.InvokeGitAgainstDotGitFolder(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrbriggs @turbonaitis, what is the status of this discussion?

Comment thread GVFS/GVFS.Common/X509Certificates/ICertificateVerifier.cs Outdated
Comment thread GVFS/GVFS.Common/Http/ConfigHttpRequestor.cs Outdated
Comment thread GVFS/GVFS.UnitTests/Common/Git/GitSslTests.cs Outdated
Comment thread GVFS/GVFS.UnitTests/Common/Git/GitSslTests.cs
Comment thread GVFS/GVFS.UnitTests/Common/Git/GitSslTests.cs Outdated
Comment thread GVFS/GVFS.UnitTests/Common/Git/GitSslTests.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
Copy link
Copy Markdown
Member

@wilbaker wilbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, @turbonaitis thanks for all the hard work putting this together!

@wilbaker
Copy link
Copy Markdown
Member

wilbaker commented Feb 5, 2019

@jrbriggs we might want to cut a release branch from master before merging this PR in.

Copy link
Copy Markdown
Member

@kewillford kewillford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a couple naming things.

Comment thread GVFS/GVFS.UnitTests/Mock/ReusableMemoryStream.cs Outdated
Comment thread GVFS/GVFS.Common/Git/GitSsl.cs Outdated
@jrbriggs jrbriggs added this to the M149 milestone Feb 11, 2019
@jrbriggs jrbriggs merged commit b0a0eb8 into microsoft:master Feb 11, 2019
@jrbriggs
Copy link
Copy Markdown
Member

Thanks for the contribution, @turbonaitis !

@turbonaitis turbonaitis deleted the ssl branch April 17, 2019 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants