-
Notifications
You must be signed in to change notification settings - Fork 22
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
Security vulnerability: Sanitize command arguments #61
Comments
I'm not sure I completely understand. Can you provide an example of the vulnerability? The design of gulp-run is to take as input a script written in If that script is being generated by another tool, then that tool assumes the responsibility of generating a valid In other words, gulp-run does not operate as a simple But again I am not sure I completely understand this issue, so maybe what I've said is beside the point. |
Hi @cbarrick, I get what you are saying. Maybe this is beyond the scope of this package, since it can become a very complex topic to convert an array of arguments to a full command line for Windows and *nix systems, given the fact that character escaping plays a role in here as well. I bypassed the issue by using |
It's best to not think of gulp-run as a wrapper around Instead, gulp-run is a wrapper around a shell. The shell is a language while So the input to gulp-run should be thought of in terms of the underlying shell language (usually Also, gulp-run does not construct the command to run, and so it has no notion of "sanitizing" it's inputs. In other words, the concept of a command injection vulnerability doesn't make sense in the context of gulp-run because gulp-run is not constructing a command. Therefore, if another package is constructing commands to send to gulp-run, that package is responsible for implementing command injection prevention. So in your specific case, I think you either want a layer on top of gulp-run which constructs a command to pass to the shell (with command injection prevention), or you want to use a different tool all together which passes the argv list directly to |
run()
/run.Command()
should accept an array and wrap arguments in double quotes if they contain spaces.This is easy to fix by ourselves, but Snyk will complain rightfully.
The text was updated successfully, but these errors were encountered: