Ghost Sandbox
This module was extracted from the Ghost blogging platform project. Its sole purpose is to create a sandboxed environment for Node.js modules.
Installation
npm install ghost-sandbox
Example 1: Using a whitelist
Using a whitelist
will only allow the the sandboxed module to require the listed modules.
"use strict"; const Sandbox = ; const sandbox = whitelist: 'when' 'lodash' ...; const sandboxedModule = sandbox;
Example 2: Using a blacklist
Using a blacklist
will only reject the listed modules.
"use strict"; const Sandbox = ; const sandbox = blacklist: 'path' 'fs' ...; const sandboxedModule = sandbox;
Note: If you include both options, the whitelist
will supersede the blacklist
.
Test
npm test
Change log
v1.0.1
- Fixed logical error when loading modules
- Updated README
v1.0.0
- Removed lodash as dependency
v0.1.1
- Updated code to ES6
v0.1.0
First version
License
(MIT License)