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

untrust

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

untrust

Run and communicate with untrusted javascript code through DSLs you define.

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

untrust

$ npm install --save untrust

let untrust = require('untrust');

Run and communicate with untrusted javascript code through DSLs you define.

Use this module to run code in a sandbox. Define an object to provide to the sandboxed code as the global. Your global object creation runs in the same process as the sandboxed code (which is not the same process as the rest of your code), so serialization does not limit how you interact with the sandboxed code.

Defining a DSL

(Documentation incomplete.)

To understand how to use this module before this documentation gets completed, read the tests (located in test/test.js).

API

untrust.run(dsl_path, code[, arg])

runs code in a sandbox, where dsl_path first creates its global object.

dsl_path: an absolute path to a javascript file containing your dsl code.

code: a string containing the code to run in a sandbox.

returns: a DownwardConnection object.

Connection

Event: 'message'
Event: 'request'
conn.request(arg)
conn.send(arg)

DownwardConnection

extends Connection.

Event: 'exit'
Event: 'error'
dc.kill()
dc.pid
dc.alive

UpwardConnection

extends Connection.

uc.error(err)

FAQs

Package last updated on 22 Jun 2016

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