-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
dangerous packages import #327
Comments
Packages now default to having all packages added. You can remove packages as wanted. If you want to have more than one package config, just import env more than once and configure as you would like. |
Also note, you can use the Go build flag |
Line 515 in 5f413ab
The import function in the VM uses a "global" variable. Line 32 in 5f413ab
As far as I know, this global variable is shared among all VMs. |
If you import env twice, there will be two env, each with there own Packages varable. |
so let's do something a bit exagerated: |
I get your point, it is not as flexible as before, however, do you understand why this change was made? How env is copied in the VMs and the resource load a VM copy was taking for most use cases? |
tbh, I don't really know why the change was made. I didn't find any explanations (other than "Simplified packages") in the commit. |
Welcome to ask questions :) |
I'm curious now ! |
The PR that commit was in had a lot going on. Performance was just a small part of it and not really the main focus. One of the main goals was splitting out env to make things cleaner, especially for testing. I do not have any benchmarks. Every time a new env was created, all the defines had to be run again. If you had a lot of VMs, this would have taken up a lot of space. So can you close this issue? |
There is a major problem in "newer" versions.
Before this commit 8016764
We had to create
NewPackage
inside the VM and import the functions we wanted.eg:
(so we could whitelist the wanted packages per VM)
Now we have to do
_ "github.com/mattn/anko/packages"
to initialize the packages, and they are all imported and available in all of your VMs.which means that by default, all VMs will have the
net/http
package (dangerous).And there is no way to have different VMs with different packages anymore.
Example of malicious usage:
If you let your users script on your website using anko.
I might want to have 1 user with net/http package enable, and other users with the package disabled. This is no longer possible.
The text was updated successfully, but these errors were encountered: