https://github.com/stewartpark/whalebox
🐋 whalebox lets you run untrusted code easily via simple HTTP APIs.
https://github.com/stewartpark/whalebox
api docker http microservice sandbox untrusted-code
Last synced: about 1 month ago
JSON representation
🐋 whalebox lets you run untrusted code easily via simple HTTP APIs.
- Host: GitHub
- URL: https://github.com/stewartpark/whalebox
- Owner: stewartpark
- Created: 2019-11-30T11:26:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-30T11:44:10.000Z (over 6 years ago)
- Last Synced: 2025-03-28T19:50:01.367Z (about 1 year ago)
- Topics: api, docker, http, microservice, sandbox, untrusted-code
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# whalebox [](https://microbadger.com/images/stewartpark/whalebox "Get your own version badge on microbadger.com") [](https://microbadger.com/images/stewartpark/whalebox "Get your own image badge on microbadger.com")
whalebox lets you run untrusted code easily via simple HTTP APIs.
Note: this is pre-alpha quality software. Use at your own peril.
## How to run locally
```bash
$ docker-compose up
```
## Usage
```bash
# Run code
$ curl -XPOST -H'Content-Type: application/json' http://localhost:5000/ -d'{"runtime": "ruby", "code": "print(\"Hello, world\")"}'
{"id":"5b99000314","labels":{"whalebox.created":"true","whalebox.runtime":"ruby"},"status":"exited"}
# Get stdout
$ curl http://localhost:5000/5b99000314
Hello, world
# If your application expects stdin, you can write to stdin as well
$ curl -XPOST 'http://localhost:5000/5b99000314?nl=1' -d'hello'
# List containers
$ curl http://localhost:5000/
{"containers":[{"id":"5b99000314","labels":{"whalebox.created":"true","whalebox.runtime":"ruby"},"status":"exited"},{"id":"5b79c7f4d8","labe
ls":{"whalebox.created":"true","whalebox.runtime":"ruby"},"status":"exited"}]}
# Run code with a user name tagged.
$ curl -XPOST -H'Content-Type: application/json' 'http://localhost:5000/?user=john123' -d'{"runtime": "ruby", "code": "print(\"Hello, world\")"}'
{"id":"dce65099f6","labels":{"whalebox.created":"true","whalebox.runtime":"ruby","whalebox.user":"john123"},"status":"exited"}
# List containers for a user
$ curl 'http://localhost:5000/?user=john123'
{"containers":[{"id":"dce65099f6","labels":{"whalebox.created":"true","whalebox.runtime":"ruby","whalebox.user":"john123"},"status":"exited"
}]}
```