Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vm2

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vm2 - npm Package Compare versions

Comparing version 0.2.4 to 1.0.0

14

lib/main.js

@@ -27,3 +27,3 @@ // Generated by CoffeeScript 1.10.0

AVAILABLE_NATIVE_MODULES = ['assert', 'buffer', 'child_process', 'constants', 'crypto', 'tls', 'dgram', 'dns', 'http', 'https', 'net', 'querystring', 'url', 'domain', 'events', 'fs', 'path', 'os', 'stream', 'string_decoder', 'timers', 'tty', 'util', 'sys', 'vm', 'zlib'];
AVAILABLE_NATIVE_MODULES = ['assert', 'buffer', 'child_process', 'constants', 'crypto', 'tls', 'dgram', 'dns', 'http', 'https', 'net', 'querystring', 'url', 'domain', 'events', 'fs', 'path', 'os', 'punycode', 'stream', 'string_decoder', 'timers', 'tty', 'util', 'sys', 'vm', 'zlib'];

@@ -240,3 +240,3 @@

function NodeVM(options) {
var j, k, len, len1, mod, ref, ref1, ref2, ref3, ref4, ref5;
var j, k, len, len1, mod, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7;
if (options == null) {

@@ -252,9 +252,11 @@ options = {};

requireExternal: (ref4 = options.requireExternal) != null ? ref4 : false,
requireNative: {}
requireNative: {},
requireRoot: (ref5 = options.requireRoot) != null ? ref5 : false,
useStrict: (ref6 = options.useStrict) != null ? ref6 : true
};
if (options.requireNative) {
if (Array.isArray(options.requireNative)) {
ref5 = options.requireNative;
for (j = 0, len = ref5.length; j < len; j++) {
mod = ref5[j];
ref7 = options.requireNative;
for (j = 0, len = ref7.length; j < len; j++) {
mod = ref7[j];
if (indexOf.call(AVAILABLE_NATIVE_MODULES, mod) >= 0) {

@@ -261,0 +263,0 @@ this.options.requireNative[mod] = true;

@@ -95,3 +95,3 @@ // Generated by CoffeeScript 1.10.0

'use strict';
var closure, code, dirname, error, error1, error2, ex, extname, filename, module, path, paths, script;
var closure, code, dirname, error, error1, error2, ex, extname, filename, module, path, paths, requiredPath, script, strictText;
if (!vm.options.require) {

@@ -140,2 +140,8 @@ throw new VMError("Access denied to require '" + modulename + "'", "EDENIED");

extname = pa.extname(filename);
if (vm.options.requireRoot) {
requiredPath = pa.resolve(vm.options.requireRoot);
if (dirname.indexOf(requiredPath) !== 0) {
throw new VMError("Module '" + modulename + "' is not allowed to be required. The path is outside the border!", "EDENIED");
}
}
vm.cache[filename] = module = {

@@ -165,3 +171,4 @@ filename: filename,

try {
code = "(function (exports, require, module, __filename, __dirname) { 'use strict'; " + (fs.readFileSync(filename, "utf8")) + " \n});";
strictText = vm.options.useStrict ? "'use strict'; " : "";
code = "(function (exports, require, module, __filename, __dirname) { " + strictText + (fs.readFileSync(filename, "utf8")) + " \n});";
} catch (error2) {

@@ -168,0 +175,0 @@ ex = error2;

@@ -16,3 +16,3 @@ {

],
"version": "0.2.4",
"version": "1.0.0",
"main": "index.js",

@@ -19,0 +19,0 @@ "repository": {

@@ -26,4 +26,2 @@ # vm2 [![Dependency Status](https://david-dm.org/patriksimek/vm2.png)](https://david-dm.org/patriksimek/vm2) [![NPM version](https://badge.fury.io/js/vm2.png)](http://badge.fury.io/js/vm2) [![Build Status](https://secure.travis-ci.org/patriksimek/vm2.png)](http://travis-ci.org/patriksimek/vm2)

**IMPORTANT: Requires Node.js 0.11+ / io.js 1.0+**
npm install vm2

@@ -82,2 +80,4 @@

* `requireNative` - Array of allowed native modules. (default: all available)
* `requireRoot` - Restricted path where local modules can be required (default: every path)
* `useStrict` - Whether to add `use strict` directive to required modules (default: `true`)

@@ -97,3 +97,4 @@ **Available modules:** `assert`, `buffer`, `child_process`, `crypto`, `tls`, `dgram`, `dns`, `http`, `https`, `net`, `querystring`, `url`, `domain`, `events`, `fs`, `path`, `os`, `stream`, `string_decoder`, `timers`, `tty`, `util`, `sys`, `vm`, `zlib`

requireExternal: true,
requireNative: ['fs', 'path']
requireNative: ['fs', 'path'],
requireRoot : "./"
};

@@ -128,3 +129,3 @@

Copyright (c) 2014 Patrik Simek
Copyright (c) 2014-2015 Patrik Simek

@@ -131,0 +132,0 @@ The MIT License

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc