-
Notifications
You must be signed in to change notification settings - Fork 295
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
TypeError: 'get' on proxy: property 'constants' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value #62
Comments
I'm also having quite a few issues around proxies, specifically with inheritance. I'm not sure if these issues are due to the implementation or a limitation of Proxies, but it's worth some investigation. |
Also ran into this error. I'm not familiar enough with proxies to understand why the current pattern is not ok but I was able to make the error go away by adding an extra check for readonly non-configurable properties in object: function(object, traps, deepTraps, flags, mock) {
const proxy = new host.Proxy(object, host.Object.assign({
get: (target, key, receiver) => {
if (key === 'vmProxyTarget' && DEBUG) return object;
if (key === 'isVMProxy') return true;
if (mock && key in mock) return mock[key];
if (key === 'constructor') return Object;
if (key === '__proto__') return Object.prototype;
// Added code
const config = host.Object.getOwnPropertyDescriptor(object, key);
if (config && config.configurable === false && config.writable === false) {
return object[key];
} This seems to follow the
But it seems to me like it would break the sandboxing |
Just chiming in to note that we've run into this issue locally as well, with the above code change allowing us to bypass the problem. Also noting that this happened while using the Google Sheets node module in an almost exact copy of their quickstart guide (https://developers.google.com/sheets/api/quickstart/nodejs). Are there any updates on this issue? |
Does this fix have an effect on the known issue "It is not possible to define class that extends proxied class?" What do you mean it would break the sandboxing? |
Hey, any progress on this issue? |
I met this error when i exported a ES6 class in the script used to run. it was ok after i translated it into |
Unfortunately, the solution posted by @mjbvz breaks the sandbox. I don't think there is a way to fix that issue - it the Proxy for read-only object can't return anything else except the original value, then we're screwed and throwing the error is the only way to keep sandbox secure. Ideas are very welcome. |
Can we get a clone in this situation? |
Clone doesn't help - a clone is also a distinct value. |
I meant a clone of |
That would allow a sandbox to make changes to the object which could cause problems within the host's scope. You need to be very careful about what you send to the sandbox because every change to the object made by the sandbox is also effective in the host's context. |
If it's read-only, do you even need a proxy to verify stuff? |
Is there any update on this issue? |
Fixed with #252. |
@XmiliaH Thank you! really appreciate it. It is working with latest version. |
Noticed this while trying to require a dependency in a vm. Some code to reproduce:
Full stack trace:
Let me know if there's any other information I can give you to be helpful!
The text was updated successfully, but these errors were encountered: