gf3 / sandbox

A nifty JavaScript sandbox for Node.js
ISC License
844 stars 123 forks source link

sandbox can crash the process #49

Open yorickvP opened 8 years ago

yorickvP commented 8 years ago

Best not allow the user to specify message names (wrap them in another message). Messages starting with NODE_ have internal meanings (search the documentation for internalMessage).

Testcase:

const Sandbox = require('sandbox')

function runInSandbox() {
    postMessage({
        cmd: "NODE_HANDLE",
        type: "net.Server",
    })
}

void function() {
    const s = new Sandbox();
    s.run(`
        ${runInSandbox.toString()};
        runInSandbox();
    `)
}()