Skip to content

Built-in properties cannot be accessed using Reflect, when Proxy is passed as vm context #7458

@psrok1

Description

@psrok1

Associated with #6158
Empty Proxy object correctly handles this case, but unfortunately it's impossible to access 'built-in' from custom getter (using Reflect)

var assert = require('assert');
var vm = require("vm");

var code = "String.prototype.f = function(){}; ''.f()";

// Test 1
assert.strictEqual(
    typeof vm.runInNewContext("String", 
            new Proxy({},{})), 
    'function');

// Test 2
assert.strictEqual(
    typeof vm.runInNewContext("String", 
            new Proxy({},{
                get: function(target, property, receiver) {
                    return Reflect.get(target, property);
                }
            })), 
    'function');

Second test returns AssertionError: 'undefined' === 'function'

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidIssues and PRs that are invalid.vmIssues and PRs related to the vm subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions