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

secure-require

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

secure-require

A secure require implementation for ECMAScript

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by233.33%
Maintainers
1
Weekly downloads
 
Created
Source

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

  1. Run each top-level dependency in a separate container.
  2. Restrict each dependency to require only a subset of core modules.
  3. Zero dependencies (duh).

Installation

npm i secure-require

Usage

const secureRequire = require('secure-require');
// Since secure-require doesn't have any dependencies, this should be fine.
safeRequire('acorn', []);
// This should pass since acorn is written without any dependencies or core modules.
safeRequire('base', []);
// This should fail since base requires the util core module.
safeRequire('base', ['util']);
// This should pass since we just allowed base to use the util module. Now, we
// need not worry about base doing anything funny with the filesystem or the
// network. It literally cannot.

License

MIT

FAQs

Package last updated on 31 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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