-
Notifications
You must be signed in to change notification settings - Fork 327
Make ssh commands used in the git smart transport compatible with libgit2 #852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
lhchavez
reviewed
Nov 7, 2021
Contributor
lhchavez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this change! there's a small vulnerability being introduced, but once that's addressed, 👍!
0d4b36c to
5078688
Compare
lhchavez
reviewed
Nov 7, 2021
5078688 to
bc0bbe9
Compare
Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ```
lhchavez
reviewed
Nov 7, 2021
github-actions bot
pushed a commit
that referenced
this pull request
Nov 7, 2021
…git2 (#852) * Fix ssh commands used in go SmartSubtransport Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ``` * Update ssh.go Co-authored-by: lhchavez <[email protected]> (cherry picked from commit 6cea7a7)
github-actions bot
pushed a commit
that referenced
this pull request
Nov 7, 2021
…git2 (#852) * Fix ssh commands used in go SmartSubtransport Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ``` * Update ssh.go Co-authored-by: lhchavez <[email protected]> (cherry picked from commit 6cea7a7)
github-actions bot
pushed a commit
that referenced
this pull request
Nov 7, 2021
…git2 (#852) * Fix ssh commands used in go SmartSubtransport Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ``` * Update ssh.go Co-authored-by: lhchavez <[email protected]> (cherry picked from commit 6cea7a7)
github-actions bot
pushed a commit
that referenced
this pull request
Nov 7, 2021
…git2 (#852) * Fix ssh commands used in go SmartSubtransport Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ``` * Update ssh.go Co-authored-by: lhchavez <[email protected]> (cherry picked from commit 6cea7a7)
github-actions bot
pushed a commit
that referenced
this pull request
Nov 7, 2021
…git2 (#852) * Fix ssh commands used in go SmartSubtransport Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ``` * Update ssh.go Co-authored-by: lhchavez <[email protected]> (cherry picked from commit 6cea7a7)
lhchavez
added a commit
that referenced
this pull request
Nov 9, 2021
…git2 (#852) (#853) * Fix ssh commands used in go SmartSubtransport Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ``` * Update ssh.go Co-authored-by: lhchavez <[email protected]> (cherry picked from commit 6cea7a7) Co-authored-by: Sunny <[email protected]> Co-authored-by: lhchavez <[email protected]>
lhchavez
added a commit
that referenced
this pull request
Nov 9, 2021
…git2 (#852) (#854) * Fix ssh commands used in go SmartSubtransport Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ``` * Update ssh.go Co-authored-by: lhchavez <[email protected]> (cherry picked from commit 6cea7a7) Co-authored-by: Sunny <[email protected]> Co-authored-by: lhchavez <[email protected]>
lhchavez
added a commit
that referenced
this pull request
Nov 9, 2021
…git2 (#852) (#855) * Fix ssh commands used in go SmartSubtransport Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ``` * Update ssh.go Co-authored-by: lhchavez <[email protected]> (cherry picked from commit 6cea7a7) Co-authored-by: Sunny <[email protected]> Co-authored-by: lhchavez <[email protected]>
lhchavez
added a commit
that referenced
this pull request
Nov 9, 2021
…git2 (#852) (#856) * Fix ssh commands used in go SmartSubtransport Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ``` * Update ssh.go Co-authored-by: lhchavez <[email protected]> (cherry picked from commit 6cea7a7) Co-authored-by: Sunny <[email protected]> Co-authored-by: lhchavez <[email protected]>
lhchavez
added a commit
that referenced
this pull request
Nov 9, 2021
…git2 (#852) (#857) * Fix ssh commands used in go SmartSubtransport Before the fix, the commands sent were of the form: ``` git-upload-pack "/bar/test-reponame" ``` This resulted in the git server returning error: `error parsing command: invalid git command` This change replaces the double quotes with single quotes: ``` git-upload-pack '/bar/test-reponame' ``` * Update ssh.go Co-authored-by: lhchavez <[email protected]> (cherry picked from commit 6cea7a7) Co-authored-by: Sunny <[email protected]> Co-authored-by: lhchavez <[email protected]>
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.
Before this change, the commands sent to the git server were of the form:
This resulted in the git server (gitkit) returning error:
error parsing command: invalid git commandThis change replaces the double quotes with single quotes:
Using git smart transport via managed ssh transport against gitkit, fails with the following errors:
Resulting in a clone failure:
unable to clone: EOF.Using ssh transport based on the libgit2 libraries work with gitkit.
Upon further investigation, I found that gitkit has a regular expression for parsing the commands and it fails to parse commands with
"(double quote). Replacing the double quotes with single quote fixes the issue.It felt like a bug in gitkit itself. So I wasn't sure if we should fix it in git2go. But after going through the libgit2 code, I found that the libgit2 implementation also uses single quotes, refer: https://github.com/libgit2/libgit2/blob/358a60e1b46000ea99ef10b4dd709e92f75ff74b/src/transports/ssh.c#L96-L99.
I guess it'd be better if we are consistent with libgit2 to maintain compatibility.