Giter Club home page Giter Club logo

run-service's Introduction

run-service

Node.js module used for safely running untrusted streaming JavaScript microservices.

see also: run-remote-service module

Introduction

This module is the component which hook.io uses to execute untrusted source code in it's elastic worker pool.

You are encouraged to use this module as-is, or modify it to suite your needs. If you are interested in contributing please let us know!

Features

  • Runs each execution of untrusted JavaScript microservice as new individual process
  • Services work with any Readable / Writable stream interface
  • Ships with run-service binary for running services from CLI using STDIN / STDOUT streams
  • Environments per service
  • Virtual Machines per service
  • Configurable Timeouts per service
  • Robust Error Handling

Caveats

Running untrusted JavaScript code in a safe way is a complex problem. The run-service module is only intended to isolate a small part of the entire untrusted source code execution chain.

If you intend to use this module to run untrusted source code please consider the following.

What this module does isolate

  • Service state
  • Service errors
  • Stream / Socket errors
  • Process state ( somewhat, read below)

Multiple service calls to run-service in the same process should not be able to affect the state of other services in that process. All errors that can possibily happen during the execution of a service should be trapped and isolated to not affect the current process.

What this mode does NOT isolate

  • Server Memory
  • Server CPU
  • Server file-system
  • Process CPU ( for now )
  • Process Memory ( for now )

run-service cannot make any guarantees about the isolation of the server or process itself. All services run in the same process will always be sharing the same process resources (memory and cpu). All services will also have default access to the server's file-system and child processes.

To ensure isolation per process, you will want to spawn a new process per service request. This can be done using the run-service binary included in this project.

To ensure isolation of the server file-system, you will want to use the run-service binary in a chroot jail, or other similiar container solution.

To ensure isolation of the server memory and cpu, you will want to use the run-service binary in a virtualized enviroment capable of monitoring and managing resource usage per process.

Bottom Line: Do not expect this single module to magically isolate untrusted services. run-service is only a small piece of the solution.

Reporting Security Issues

If you find a way which run-service is not adquately isolating services per process or trapping errors, please file a support issue on Github. You can also privately email [email protected]

run-service's People

Contributors

marak avatar

Watchers

Jun Matsushita avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.