Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
securely running untrusted code in Node.js
Usage:
$ node sandbox.js
based on LintServer by Jakob Kruse:
https://github.com/jkruse/LintServer
var fs = require("fs");
var vm;
try {
vm = require("vm");
} catch(exc) { // Node.js v0.2
vm = process.binding("evals").Script;
}
var filename = "untrusted.js";
var source = fs.readFileSync("./" + filename, "utf8");
var sandbox = {};
vm.runInNewContext(source, sandbox, filename);
var fs = require("fs");
var text = fs.readFileSync("./dispatch.js", "utf8");
console.log(text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.