nafees87n / codebox

codeBox RCE is a service that provides a remote environment to run your code in. Execution occurs in a containerized space. The API supports programming in 3 languages (Python, Javascript and C++), potentially extendable to support more.
http://codebox.herokuapp.com/
MIT License
9 stars 9 forks source link

codeBox - A Remote Code Executer

Available at: http://codebox.herokuapp.com

NOTE: Do NOT access the https version of the above site. The API server does not currently have an SSL certificate, and so the https client will not be able to communicate with the API due to the Mixed Content policy implemented in browsers.

The API is seperately accessible here, for use with Postman or cURL. However it is recommended to use the heroku app linked before.

Client App Demo Gif


Contribute

We are accepting contributions to codeBox! Check out CONTRIBUTING.md to learn more. Make sure to read our docs to learn about the set up process.

Feel free to make an issue if you have any inquiry or doubt. Use the question label for this.

What Is It?

codeBox RCE is a service that provides a remote environment to run your code in. Execution occurs in a containerized space. The API supports programming in 3 languages (Python, Javascript and C++), potentially extendable to support more.

This RCE project provides a basic API to execute programs on a remote server. Basic code validation is performed to prevent possibly malicious code.

The client application, linked above, is available to access the API. It enables live sharing of your work through realtime communication with the server, aimed towards interview sessions. Each user obtains a sessionId key. Users can join another session by entering the other session's ID. Joining a session permits you to observe the session in read-only mode, only the session creator can edit the code and input.

Features

Architecture

Codebox Architecture

Set Up

User set up for this project is not required, as a deployed version can be accessed through the client app (linked at the top).

However if you wish to set the project up yourself, documentation has been provided in the docs folder. Check out DOCS.md for a detailed reference. It describes local machine setup and service functioning. Read SERVER.md for documentation on deployment.

Tech Stack

This RCE project combines various different technologies:

Functioning

The API accepts POST requests at the localhost:9000/code or http://13.235.81.188/code endpoint.

Request JSON Keys:

Supported Languages:

Code Validation:

Currently, code validation takes place by selectively rejecting or accepting libraries depending on the language. The list of libraries of concern are listed below

Python (Rejected Libraries):

os | subprocess | shlex | xml | pickle

C++ (Accepted Libraries):

iostream | algorithm | stdio    | cstdio | vector | math | cmath | cstring | string |
deque    | iomanip   | iterator | map    | queue  | set  | stack | conio   | ctype

Node/Javascript (Accepted Libraries):

readline | buffer | string_decoder | timers | stream | util