Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit 2cc7de9

Browse files
committed
sandbox: remove pyduktape
1 parent a3b19ab commit 2cc7de9

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

docker/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ ENV TIMEOUT="5"
77
ENV DEBUG="0"
88
VOLUME "/mnt/code"
99

10-
RUN apk --update add --no-cache python3 bash binutils libc-dev python3-dev gcc git libseccomp-dev strace nodejs
11-
RUN pip3 install -U pip
12-
RUN pip3 install pyduktape
10+
RUN apk --update add --no-cache python3 bash binutils libc-dev gcc git libseccomp-dev strace nodejs
1311

1412
WORKDIR "/go/src/app"
1513
COPY . .

docker/main.go

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -58,36 +58,6 @@ func execPython(timeout time.Duration, code *string) (stdout string, stderr stri
5858
return
5959
}
6060

61-
func execJs(timeout time.Duration, code *string) (stdout string, stderr string) {
62-
debug("applying seccomp filter for JavaScript")
63-
64-
ApplySyscallRestrictions()
65-
66-
debug("building command context with %v timeout", timeout)
67-
ctx, cancel := context.WithTimeout(context.Background(), timeout)
68-
defer cancel()
69-
70-
cmd := exec.CommandContext(ctx, "./js.py")
71-
cmd.Stdin = strings.NewReader(*code)
72-
73-
var errBuffer bytes.Buffer
74-
cmd.Stderr = &errBuffer
75-
76-
debug("executing command ...")
77-
out, _ := cmd.Output()
78-
79-
if ctx.Err() == context.DeadlineExceeded {
80-
debug("command timed out")
81-
stderr = "command timed out"
82-
return
83-
}
84-
85-
stdout = string(out)
86-
stderr = errBuffer.String()
87-
88-
return
89-
}
90-
9161
func execNode(timeout time.Duration, code *string) (stdout string, stderr string) {
9262
debug("applying seccomp filter for NodeJS")
9363

@@ -163,9 +133,7 @@ func main() {
163133

164134
if language == "python" || language == "py" {
165135
stdout, stderr = execPython(duration, &data)
166-
} else if language == "javascript" || language == "js" {
167-
stdout, stderr = execJs(duration, &data)
168-
} else if language == "node" {
136+
} else if language == "javascript" || language == "js" || language == "node" {
169137
stdout, stderr = execNode(duration, &data)
170138
}
171139

0 commit comments

Comments
 (0)