New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sand-require

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sand-require

require modules as sandboxed objects

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
2
Weekly downloads
 
Created
Source

sand-require Build Status

require modules as sandboxed objects

What

To treat the required module as a sandboxed object, you need to avoid passing by reference somehow. There are two ways to do that. That's deep-copying or overwriting the setter of the module object. This sand-require realizes the latter. The object created through the sand-require is an object that internally generates a recursive Proxy object and allows only the getter call.

Installation

$ npm install --save sand-require

Quick example

const sandRequire = require('sand-require')
const http = sandRequire('http')

console.log(http.STATUS_CODES['200'])
// => OK

delete http.STATUS_CODES // nothing happens
console.log(http.STATUS_CODES['200'])
// => OK

FAQs

Package last updated on 24 Nov 2017

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