Giter Site home page Giter Site logo

Advantages over the native VM module about vm2 HOT 4 CLOSED

odino avatar odino commented on May 22, 2024 1
Advantages over the native VM module

from vm2.

Comments (4)

patriksimek avatar patriksimek commented on May 22, 2024 2

You can try it yourself:

const vm = require('vm');
vm.runInNewContext('this.constructor.constructor("return process")().exit()');
console.log('Never gets executed.');

vs

const {VM} = require('vm2');
new VM().run('this.constructor.constructor("return process")().exit()');

from vm2.

patriksimek avatar patriksimek commented on May 22, 2024

The vm2 library doesn't fix anything, it uses internal VM as is. The reason to use vm2 is to execute a code and prevent it to access things outside the VM context.

from vm2.

odino avatar odino commented on May 22, 2024

from vm2.

odino avatar odino commented on May 22, 2024

Ouch :( that's nasty!

Thanks for updating the readme.

from vm2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.