Answer the question
In order to leave comments, you need to log in
How do sites that allow you to run code in the playground (execution on their server) work?
How do sites like this work that allow you to run code on their server?
Some new programming languages have playground pages on their websites where you can run your code. How do they deal with issues like "harmful" code? Write code with an infinite loop with huge calculations and send it to be executed?
For example, I want to make a javascript playground. Where is it better to run it: in nodejs on the server, in a docker container, maybe you can compile the code using LLVM?
How to set execution limits? Is there any way to analyze the code?
I also wanted to see how NoSQL databases work with a javascript query language, but I think this is a little different.
Answer the question
In order to leave comments, you need to log in
link (username and password are arbitrary)
Project written by me, principle of operation:
1. The code is sent to the server
2. The C ++ daemon is running on the server, which checks the database for compilation requests
3. The daemon finds a compilation request, passes it to the next module
4 The module compiles and then isolates itself and executes the program (only system libraries are available to the compiled program).
Also, for those who are especially picky (if there are any), many system files are available for reading (I defended myself only against the threat of causing real harm to the server, so I didn’t bother setting read rights to all files.
for javascript
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question