secure-require
A secure require implementation for ECMAScript
Feel more confident running a bunch of untrusted dependencies as a part of your
application or module by allowing said dependency to only use a subset of core
APIs. This allows you to make sure that none of the sub-dependencies try
anything unexpected, no matter which version you upgrade to.
Features
- Run each top-level dependency in a separate container.
- Restrict each dependency to
require
only a subset of core modules. - Zero dependencies (duh).
Installation
npm i secure-require
Usage
const secureRequire = require('secure-require');
safeRequire('acorn', []);
safeRequire('base', []);
safeRequire('base', ['util']);
License
MIT