C++ Backend - Remote Script Execution

For some context im working on this leetcode type application im trying to write where people can post their own questions, submit solutions, leaderboards etc. The user will be presented with a question, some examples and a function prototype they need to implement for the solution. I've come pretty far along but now I just need to handle running the scripts securely, without too much overhead. Having some sort of test case generation (I'll implement the whole TLE and Space Limit stuff later) Now what I'm thinking for the "secure" part is to have a pool of docker containers or something, I use when available. For running the Python scripts I'm thinking of having some sort of Python wrapper that takes in the script's path imports the function and runs it against our generated test cases. Now for our test case generation, I was thinking of having like a config file type thing the user fills out to determine what kind of inputs and outputs to expect. But this all still feels like a lot of work for a person to do to post a question. (question body, correct answer script and a config defining function prototype, return types etc). Idk, what I'm getting at is this just feels like a bit of a shitty way to approach this problem and was looking for alternate POVs to how I can implement something like this. https://github.com/mush1e/RCE P.S (Don't ask me why it's in C++, I'm a bit special in the head)
GitHub
GitHub - mush1e/RCE: Remote Code Execution Platform
Remote Code Execution Platform. Contribute to mush1e/RCE development by creating an account on GitHub.
27 Replies
mu5h1e
mu5h1eOP8mo ago
pls elp my brain hurts ;-;
muscle aggregator 82
Unfortunately low overhead and docker do not mix
mu5h1e
mu5h1eOP8mo ago
I was thinking alternately to just have a process and restrict its resources
muscle aggregator 82
Are you trying to host on Linux?
mu5h1e
mu5h1eOP8mo ago
Yeah
muscle aggregator 82
I’m sure you can figure that out then. What’s the problem?
mu5h1e
mu5h1eOP8mo ago
I think ive just hit a mental roadblock rn tbh
muscle aggregator 82
The question is whose experience are you optimizing for, the poster or the solver
mu5h1e
mu5h1eOP8mo ago
Solver But i dont want it to be annoying for the poster either Idk doing the whole config thing seems like alot I essentially want this to be something that we could use for the dsa course
muscle aggregator 82
Config doesn’t sound too bad if it’s well documented. If it’s JSON it will be easy to fill out
mu5h1e
mu5h1eOP8mo ago
I could also just have a form that ill turn to json
muscle aggregator 82
Tbh forms are cancer. Your poster are gonna be programmers, they will probably prefer to work with json in their favorite text editor than a web form
mu5h1e
mu5h1eOP8mo ago
Yeah youre right Forms are so cancer
muscle aggregator 82
Keep it simple
mu5h1e
mu5h1eOP8mo ago
If anything doing this project has been teaching me a shitload
muscle aggregator 82
Start with something standard and quick to implement - JSON
mu5h1e
mu5h1eOP8mo ago
Yeah im pretty sure ive also written a json parser for my backend so works out
muscle aggregator 82
Or just use an existing one if you’re lazy like me
mu5h1e
mu5h1eOP8mo ago
Lmao true
muscle aggregator 82
I doubt the perf of parsing will matter because your JSON payloads should be small Focus on getting blazingly fast submission and execution for that blessed solver UX
mu5h1e
mu5h1eOP8mo ago
Yeah honestly the whole point of this project was to get from nothing to a decent web app Which is why im trying to handroll everything
muscle aggregator 82
Some things just ain’t worth hand rolling Certainly not a JSON parser
mu5h1e
mu5h1eOP8mo ago
In hindsight i do agree Like all the threadpool stuff was fun but implementing http was alot
muscle aggregator 82
It’s never a wasted opportunity to learn but if you want to get things out in a reasonable timeframe you gotta cave to the libs
mu5h1e
mu5h1eOP8mo ago
Atleast I can write a juicy article about it when im done :3
muscle aggregator 82
That’s the spirit Milk it like a cow’s tit Damn I should write some articles
Want results from more Discord servers?
Add your server