Git Product home page Git Product logo

sandbox-in-docker's Introduction

Free your Sandbox using Docker

Run an unrestricted Clojure sandbox using Docker. Runs absolutely any code you throw at it over HTTP, prevents malicious users from doing anything to your system or network, and restarts its workers if they're killed. Why sandbox when you can Docker?

Deploying

Try it out for yourself using Docker!

git clone [email protected]:thieman/sandbox-in-docker
sandbox-in-docker/start_sandbox  # see this script for the full Docker commands

Architecture

The sandbox is deployed with Docker. The main sandbox instance is referred to as the "master" and is responsible for providing the HTTP endpoint to accept and respond to incoming evaluation requests. This runs on top of your actual machine, the "host."

The sandbox executes any Clojure code you throw at it with no restrictions at all. To allow this with a modicum of sanity, the master spins off child Docker containers to execute the Clojure code. These containers are modeled off of Docker in Docker and are fully expendable. They are cut off from the Internet and are only allowed to communicate on port 8080, which they use to talk to the master container using ZeroMQ. If anything causes an executor to time out when executing Clojure code, the master will kill it and spin up a new container to replace it.

TODO and/or Glaring Flaws

This project is a proof of concept and has some serious flaws. Here's just a few:

  • Currently, there is actually only one exec process in the pool.
  • All users are talking to the same underlying Clojure environment, meaning they can mess with each other's namespaces. This also means that the entire environment is lost if some smartass runs (system/exit 0).
  • The master will restart an executor if it does not return after 10 seconds. However, this does not prevent someone from having some sort of infinite loop fire after X seconds. We should have CPU/RAM monitoring on the executors and restart them if they're acting up.
  • There are no measures in place to blacklist malicious actors.

License

Copyright © 2014 Travis Thieman

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

sandbox-in-docker's People

Contributors

thieman avatar

Watchers

 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.