-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Reject potential option injections over ssh #6636
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
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
This function returns true if the string starts with a `-` as that could be used to inject options into commands we execute.
If you pass along something like `-oProxyCommand=...` as the hostname, we would pass that along to ssh unbeknownst to us and potentially also the user, if they were asking a tool to recursively clone submodules. This is the same fix as mainline git although they don't separate the username and host for ssh so ours looks like it's checking more.
Like in the previous commit and in git, we reject a path that looks like an option to avoid injection into the command we ask the remote to execute.
Oops I fat fingered the mobile app and marked this for ready for review. 😅 |
017062e
to
b745268
Compare
b745268
to
ad3799e
Compare
OK I think we're good to go now. |
Thanks @carlosmn -- sorry for the delay here. I was thinking that |
Yes, that namespace make sense, I was just trying to fit it into the existing ones. |
Thanks Carlos! |
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.
Like git (and basically everyone else, that was a fun CVE) did a while ago, we need to reject urls that might inject options into ssh which could cause it to execute arbitrary commands instead of what we mean for it to execute.
This is on the yet-unreleased exec-based transport so a public PR should be fine.
As git does, we also reject suspicious paths which may be trying to inject options into the command we ask the remote to execute. This is out of an abundance of caution.
I'm opening this up as a draft as we should have at least a little bit of testing there.
I put the function in with the
net
ones because I couldn't think of where to put it. git puts it with some path functions but our organisation is different.