Implement valid parameter for RemoteCallbacks::certificate_check#1146
Open
brysonsteck wants to merge 3 commits intorust-lang:masterfrom
Open
Implement valid parameter for RemoteCallbacks::certificate_check#1146brysonsteck wants to merge 3 commits intorust-lang:masterfrom
brysonsteck wants to merge 3 commits intorust-lang:masterfrom
Conversation
Contributor
|
Hm, I'm a little uneasy about assuming what the callback wanted in this case. What about updating the callback to take the (The documentation error seems to be carried over from libgit2. I opened libgit2/libgit2#7119 to clarify it.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the RemoteCallbacks struct documentation, the certificate_check function has this description:
However, this statement is false. It turns out that this function never actually checks if the certificate is valid using the
cert_validparameter passed intocertificate_check_cbfrom thecheck_certificatefunction in libgit2. As a result, when a callback function is specified, the function will always run regardless if libgit2 marks it valid.I made the change in the function specified to skip the callback if the certificate is valid (
valid = 1). Before, any SSH remotes would run this callback, and now only hosts that do not appear in my hosts file (~/.ssh/known_hosts) will result in the callback being ran.If there are any changes I need to make, let me know! :)