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
Any reason why most builtin modules are proxied rather than being required in the sandbox? #101
Comments
related to #127 |
I went ahead and changed the if statement to:
I found that in node 8.x I ran in to issues with async_hooks |
I also found an alternative solution (one I think fits the paradigm better). Basically what I found was contextified code was trying to write to a prototype of an object it created in its context, but which extended an object brought in from another context. Per the documentation on the set proxy handler, if the property does not exist on the object you are trying to set, the prototype set handler will be called. So; And when the set handler is called, the receiver argument will be set to the original object we were trying to set on. My solution was this:
|
This comment has been minimized.
This comment has been minimized.
* 1. if object extends another object from contextified code, uncorrect proxy setter make it not settable * 2. this fix just change the proxy setter in contextify * 3. detail patriksimek#101 (comment)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi,
I'm trying to figure out why builtin modules are proxied from the host and not being required in the vm.
this is my setup currently:
inside the VM I require an external module (
axios
if that matters) and in the chain of dependencies it requires another module (follow-redirects
) that does this (more or less):running this code inside the vm throws: TypeError: 'set' on proxy: trap returned falsish for property '_performRequest'.
The stream object is being proxied to the vm.
running this code when
stream
is being actually required inside the vm (by removing the if statement here: https://github.com/patriksimek/vm2/blob/master/lib/sandbox.js#L133) is working.running node 6.10.3 on osx.
Thanks
The text was updated successfully, but these errors were encountered: