npm.io
0.0.9-beta • Published 8 years ago

crossvm

Licence
MIT
Version
0.0.9-beta
Deps
1
Size
106 kB
Vulns
0
Weekly
0
Stars
2

Cross VM

Browser compatible Node VM

By using this library you will be able to containerize JS codes and evaluate the codes in the browser

Install

Sadly for now you can only use NPM to use this package.
(Webpack-bundle is coming)

npm install --save crossvm

Testing

Writing tests is in progress

Example

Look at Node's VM official documentation

Note

CrossVM is not a security mechanism. Do not use it to run untrusted code.
There is always a way to get out of sandbox like:

const {createContext, run} = require('crossvm');
const context = createContext();
run('"".constructor.constructor("return this")().console.log=()=> { throw new Error("pwnd");}', context);
console.log("Hello world");

(Thanks to Dark Marouane for clarifying this)

Keywords