-
Notifications
You must be signed in to change notification settings - Fork 93
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
Way to disable go get import and enforce to use only defined import list #151
Comments
There's currently no mechanism to disable A word of warning: if you are thinking about using gomacro to create a "safe sandbox", where you can execute arbitrary untrusted Go code, disabling You also need to limit Also, same-language sandboxes don't work very well: the Java Applet security disaster taught a harsh lesson on this topic. A diagram would be: +-------------+ +---------+ +---------+ +---------+ +------+
| untrusted | | | | reflect | | Go | | |
| interpreted | <-> | gomacro | <-> | package | <-> | runtime | <-> | OS |
| code | | | | | | | | |
+-------------+ +---------+ +---------+ +---------+ +------+ Starting from the right, the OS trusts the system calls it receives, i.e. (by default) it does not "sandbox" processes. In theory, one can try adding a sandbox mechanism at some level, Adding a sandbox mechanism at any other level is not robust: In other words, there is no language barrier, which is one of the few places where one can add a robust sandbox mechanism. |
Oh yeah, no not-trusted logic execution is needed - just to not scare users, when by accident user will add some unsupported module import and gomacro would try to get it. Just trying to make the module-writers life a bit easier in the future. But could imagine how the complete whitelist of imports will be helpful in other projects to sandbox the logic. Yeah I agree - any sandboxing is much more complex system, which involves the OS fortification, but let's look at the limitations of imports as just another tool to steer the user in the right direction. It should have a huge warning in docs, that this feature is not for executin ofg the untrusted code. I would love to try my skills and add this import limit feature to the gomacro - but not sure how much it will take... |
Oh, that was much easier than I expected! So, added #152 : I found that it's relatively easy to manipulate the Also I noticed a possible need for Allow/Deny lists, so added them there as well - by default they are empty so should not penalty the performance much. But if you think it's too much - they are not needed for this particular issue I described, I will be good just with Not quite sure if |
Hi, question - trying to keep the execution environment of gomacro more controllable and allow only predefined packages to be usable, otherwise raise an error that the package is not allowed to be used. Is there any way to do this?
The text was updated successfully, but these errors were encountered: