mu5h1e
CPSComputer Programming - Seneca Polytechnic College
•Created by mu5h1e on 4/9/2024 in #ask-a-question
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)
38 replies
CPSComputer Programming - Seneca Polytechnic College
•Created by mu5h1e on 3/19/2024 in #ask-a-question
C++ backend URL Routing
currently im writing this web app with my backend being in c++
basically after parsing the http request string I just have a bunch of conditional statements calling relevant "controllers" to handle actions
for example
with controllers which are defined like bellow with some logic
rather than having an increasingly large if else tree for every route im thinking of something like this
where
router[URL][http method] will store the relevant controller
now the major issue im having is not all controllers have the same number of arguments
would anyone be able to help me with a design for my router class to circumvent this?
21 replies
CPSComputer Programming - Seneca Polytechnic College
•Created by mu5h1e on 9/24/2022 in #ask-a-question
Uniformly Distributed Random Function in c?
Trying to implement a function to approximate the value of pi, for which to be accurate I need uniformly distributed random numbers(float). Any hints on how I would go about implementing that?
13 replies