-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
vm: strict mode ReferenceError with assignment to context property #12300
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Probably cannot be fixed easily without regressing #10223. The problem is that Adding the check is not enough by itself. It should also record and check property attributes, otherwise non-writable properties can be overwritten. |
We don't have coherent behavior what to do on the sandbox, when the setting/getting/deleting/defining fails or has side effects. @AnnaMag is about to open a PR that removes the CopyProperties() hack. Once that landed we should come back to this and rethink it. |
Should this remain open? |
It's still an issue. We could add a |
GlobalPropertySetterCallback() does not check the property on the sandbox. It wrongly throws an error instead of updating `x`. Refs: nodejs#12300
GlobalPropertySetterCallback() does not check the property on the sandbox. It wrongly throws an error instead of updating `x`. PR-URL: #14661 Ref: #12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
GlobalPropertySetterCallback() does not check the property on the sandbox. It wrongly throws an error instead of updating `x`. PR-URL: nodejs/node#14661 Ref: nodejs/node#12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
GlobalPropertySetterCallback() does not check the property on the sandbox. It wrongly throws an error instead of updating `x`. PR-URL: nodejs/node#14661 Ref: nodejs/node#12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
GlobalPropertySetterCallback() does not check the property on the sandbox. It wrongly throws an error instead of updating `x`. PR-URL: #14661 Ref: #12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
GlobalPropertySetterCallback() does not check the property on the sandbox. It wrongly throws an error instead of updating `x`. PR-URL: #14661 Ref: #12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
GlobalPropertySetterCallback() does not check the property on the sandbox. It wrongly throws an error instead of updating `x`. PR-URL: #14661 Ref: #12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
This patch fixes the problem with variables that are declared only on the sandbox but not on the global proxy. Fixes: nodejs#12300
This patch fixes the problem with variables that are declared only on the sandbox but not on the global proxy. PR-URL: #16487 Fixes: #12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This patch fixes the problem with variables that are declared only on the sandbox but not on the global proxy. PR-URL: #16487 Fixes: #12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This patch fixes the problem with variables that are declared only on the sandbox but not on the global proxy. PR-URL: #16487 Fixes: #12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This patch fixes the problem with variables that are declared only on the sandbox but not on the global proxy. PR-URL: nodejs/node#16487 Fixes: nodejs/node#12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This patch fixes the problem with variables that are declared only on the sandbox but not on the global proxy. PR-URL: nodejs/node#16487 Fixes: nodejs/node#12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This patch fixes the problem with variables that are declared only on the sandbox but not on the global proxy. PR-URL: nodejs/node#16487 Fixes: nodejs/node#12300 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
I found the vm module still throws a weird error when replace 'use strict';
const vm = require('vm');
const ctx = vm.createContext({ x: 42 });
try {
const result = vm.runInContext('"use strict"; x = function demo(){};', ctx);
} catch(e) {
console.log(e.stack);
console.log('x is', ctx.x)
} as it throw this error:
Is there anything might be missing in the last bugfix patch? |
Split off from #5344 (comment).
The text was updated successfully, but these errors were encountered: