-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Check: curl/wget piped to sh #1794
Comments
I like the premise of this suggestion, but I don't think it goes far enough. All shell invocations that don't specify a script file or a command (via Also: curl https://dodgy-website/install.sh | sudo foo That tells # dynamically install repository public keys
curl https://some.place.net/pub.asc | sudo apt-key add - I assume you mean: curl https://dodgy-website/install.sh | sudo -i # or "sudo -s" which actually runs |
As much as I have been in the same camp as where this suggestions stems from I am more on the line of what is written in this blog post these days. I am not certain that it is up to shellcheck to make claims in this area. |
It is also less secure, as that blog post itself states:
Of course it's not some kind of security armageddon. But where to draw the line is a decision. The suggested language in this feature request is not unreasonable imo. I don't know what's wrong with providing a warning. A workflow with a pre-commit hook for shellcheck would mean one must explicitly disable this warning as a way of asserting that yes, I have vetted this source and decided they are trustworthy. That's something people should be doing when they are executing someone else's code dynamically in a manner that is flatly incompatible with version pinning or auditing. |
While |
This author's response to the "isn't so bad" article is that publishers start optimizing for the kind of user that is otherwise well served by |
Thanks for the feedback, everyone! Perhaps labeling this check as If you agree, I'd suggest we be pragmatic, and not try to solve the general class initially -- but maybe it's larger than |
Please to look at this logical eye: Assume the discussion has run it's course and it is decided that Would And then, if another user chooses to |
For new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
(Nothing)
Here's what I wanted or expected to see:
Basically, there's a common, but dangerous practice of downloading scripts and immediately passing them to another shell (sh, bash, etc., but it could be any interpreter). Downloading is most commonly done using curl or wget.
Is this the type of rule that belongs in Shellcheck? My Haskell is very, very beginner, but I'd be happy to submit a PR for feedback if you're interested.
The text was updated successfully, but these errors were encountered: