-
Notifications
You must be signed in to change notification settings - Fork 18k
os/exec: document lack of shell expansion more #20894
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
Comments
Thanks Brad! |
Brad my one comment would be that maybe if it's possible to return a parse error when splat or similar are passed. Many people might miss the new documentation and it'd be great to see a valid error rather than error code 2. But I realize that star can be used in a parameter and still be valid so it might be difficult to support generically with better error messages. No biggie but there's my two cents. Lol. I wrote a file to the system with the splats and called it from golang as a workaround. |
We don't parse. |
Having a cross platform version of system(3) in os[/exec] might be an answer as well. |
No! Do not put system(3) in the library. It's one of the most glaring security holes a library can provide. Instead, document in os/exec that you get what you say and if you need the shell, use it - carefully! |
One can already do |
Yes. You have to be knowledgeable enough to know about sh -c. |
CL https://golang.org/cl/47550 mentions this issue. |
It's becoming a FAQ that people expect os/exec to expand '*' etc like the shell. (#20893 and a number more)
Many scripting languages provide such APIs (often by default), even though they're easy to misuse security-wise.
Let's document that os/exec requires explicit shell invocation or explicit globbing.
The text was updated successfully, but these errors were encountered: