Skip to content
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

Dependabot alert: Command Injection due to insecure usage of the --upload-pack feature of git #15

Open
anthonyhaffey opened this issue Jul 8, 2022 · 12 comments

Comments

@anthonyhaffey
Copy link

anthonyhaffey commented Jul 8, 2022

Hi there, this package has been really helpful for my software! Just asking if there is there going to be an update to git-clone to deal with the following dependabot alert:

Affected versions <= 0.2.0

All versions of package git-clone are vulnerable to Command Injection due to insecure usage of the --upload-pack feature of git.

Side-note: my understanding is that this would be less of a concern for people using node-js for software on their computer, but a bigger issue for node-js on a server, is that a fair assessment?

@jaz303
Copy link
Owner

jaz303 commented Jul 8, 2022

I'm struggling to see how this is any more of a security vulnerability than a stdlib function like spawn().

git-clone has an args option for passing arbitrary CLI arguments to git. Using this option with untrusted user input is obviously a recipe for security problems, and the documentation states this explicitly. Attempting to perform some sort of automatic input sanitisation is, IMO, far outside this library's scope.

One thing I've considered is a separate git-clone/unsafe import that explicitly enables the args option, but of course that would break backwards-compatibility and require a major version change.

(as an aside, I think the "vulnerability" report is rather insidiously worded - git-clone doesn't use --upload-pack in of itself)

@anthonyhaffey
Copy link
Author

Thanks @jaz303 for the quick reply. Sorry that my posting of this issue reflects a lack of understanding about the validity of the dependabot alert; it's a shame that this is being alerted when sensible usage of git-clone isn't a liability (at least based on my understanding of your reply).

I'm happy for you to close/delete this issue.

@jaz303
Copy link
Owner

jaz303 commented Jul 8, 2022

Please don't apologise, any frustration I feel is definitely not directed at yourself.

I think I'll leave this issue open as I'm keen to hear others' opinions.

@jaz303
Copy link
Owner

jaz303 commented Sep 19, 2022

I've read all of these.

git-clone doesn't use upload-pack; it's explicitly documented as a shell command wrapper, and exposes a method for passing arbitrary arguments to the git executable. Obviously care needs to be taken if passing dynamic/untrusted input. I fail to see how this is a vulnerability any more than a standard library function like spawn.

@Kristories
Copy link

Yes, I know. Perhaps you could provide this information in the readme, as git-promise did.

@jaz303
Copy link
Owner

jaz303 commented Sep 19, 2022

I did:

NOTE: the args option allows arbitrary arguments to be passed to git; this is inherently insecure if used in combination with untrusted input. Only use the args option with static/trusted input!

@Kristories
Copy link

Thanks for the information. I didn't see that warning, because I was too focused on dependabot and npm audit.

@emorneau
Copy link

Will we eventually remove that option out of this repository to remove that potential vulnerability. It shows as a Snyk High vuln. which is very annoying even if we do not use this option. Maybe create a new repo git-clone-unload-pack which adds in that extra feature, if people desire to use this risky option.

@jaz303
Copy link
Owner

jaz303 commented May 18, 2023

No I will not be doing that. It's not a "risky option". git-clone doesn't directly use upload-pack. Did you even read this thread?

@emorneau
Copy link

I see that it is an inherited security vuln. from git-promise. Sorry and thanks for the quick reply above.

@hakt0r
Copy link

hakt0r commented Jul 11, 2023

Honestly why not create a bug with git itself?! It seems to me that some downstream users allow unfiltered arguments to be injected and they are just pointing fingers. This is not a security issue, indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants