Explicitly switch user for code execution.

Co-authored-by: Maximilian Pass <maximilian.pass@student.hpi.uni-potsdam.de>
This commit is contained in:
Sebastian Serth
2022-09-18 01:52:15 +02:00
committed by Sebastian Serth
parent 69237fb415
commit 1a5a49d7c8
13 changed files with 144 additions and 67 deletions

View File

@ -17,11 +17,14 @@ type RunnerRequest struct {
// ExecutionRequest is the expected json structure of the request body for the ExecuteCommand function.
type ExecutionRequest struct {
Command string
TimeLimit int
Environment map[string]string
Command string
PrivilegedExecution bool
TimeLimit int
Environment map[string]string
}
// FullCommand joins the environment variables and the passed command into an "sh -c" wrapped command.
// It does not handle the TimeLimit or the PrivilegedExecution flag.
func (er *ExecutionRequest) FullCommand() []string {
command := make([]string, 0)
command = append(command, "env")