Skip to content

An MVP to run untrusted code in an education environment

Notifications You must be signed in to change notification settings

finia2NA/coderunner

Repository files navigation

CODE RUNNER

An MVP to demonstrate running student code securely in Docker containers and checking against a predefined result.

The web server exposes the /stub endpoint, where the code to complete is retrieved from. More importantly, the /run endpoint is exposed, to which a user can post with a body that contains the "code" key and the code to run as the value.

When code is submitted, a container is built that contains the exercise framework, and the student's code. This is then executed, and the result is piped back into the Express server. Here, it is checked if the words "fail", "failed" or "error" are present. If not, the code is considered to have passed.

To define an exercise, you need to define how to initialize the exercise environment in the init.Dockerfile. Additionally, the exercise.mjs file needs to be defined, which is the logic that checks the result of the code. The submissionstub.mjs file is the file that contains the stub code that the user needs to complete. The student.Dockerfile is the file that defines how the student code is injected into the container and run.

The App is run by executing npm run dev in the root directory.

This is a request that passes the currently provided sample exercise:

About

An MVP to run untrusted code in an education environment

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published