The objective of this project is to create a website with computer science problems. (Reference: hackerrank, leetcode, pbinfo, infoarena) The user must be able to run the code and display the output / error. When the user thinks that he has a correct solution, he must be able to publish his code and it will be analyzed, then displaying its correctness. Back-end will use Django and for front-end React.
For now, the goal is for the user to be able to run Python code. For now, I need to find a way to run the Python code from the user in a safe way.
exec, eval: too unsafe, takes too much time to implement something decent
Really good article about the available options
To check the realiability of the sandbox, check this
-
pysandbox - deprecated
-
PyPy sandbox - unmaintained
-
Docker - very good idea, hard to set up, could use multiple coding languages
-
epicbox really good combination with Docker
Really good article about the available options
They run in the browser, meaning that security is not concern and the execution is handled on the user's machine.
-
PyPyJS - python 2.7, unmaintained, 12mb script import
-
Brython - python 3.9.0, no imports, good idea
-
Brython Runner - Brython module, great idea
-
Skulpt - python 2.7, limited imports(?)
-
Anvil - python 2.7(?), website builder, pay to remove sponsor header
Currently using Brython, will switch to Docker.
Using React-Ace for a code editor with multiple features (syntax highlighting, autocompletion, themes).
Pull requests, ideas, anything is welcome.