test(runner): verify sandbox isolation with a hostile program suite

This commit is contained in:
shira committed 2026-10-11 08:59:59 +03:00
1 parent afee564bf4
commit e858280d91
38 files changed
+1359 -168

No files matched your search

+6 -2
View File
@@ -14,7 +14,10 @@ COPY go.mod go.sum ./
RUN go mod download
COPY . ./
RUN CGO_ENABLED=0 GOOS=linux go test -c -tags sandbox -o /out/isolation.test ./internal/isolationtest \
ARG RUNNER_VERSION=unknown
RUN CGO_ENABLED=0 GOOS=linux go test -c -tags sandbox \
-ldflags "-X lincodex/runner/internal/isolationtest.runnerVersion=${RUNNER_VERSION}" \
-o /out/isolation.test ./internal/isolationtest \
&& CGO_ENABLED=0 GOOS=linux go test -c -tags sandbox -o /out/judge.test ./internal/judgetest
FROM ${RUNNER_IMAGE}
@@ -26,4 +29,5 @@ ENV RUNNER_HOSTILE_FIXTURES=/opt/lincodex-runner-tests/testdata/hostile \
RUNNER_JUDGE_FIXTURES=/opt/lincodex-runner-tests/testdata/judge
HEALTHCHECK NONE
ENTRYPOINT ["/bin/sh", "-c", "set -e; for suite in judge isolation; do /opt/lincodex-runner-tests/$suite.test -test.v -test.count=1; done"]
# With arguments, only the A16 suite runs with them; without, both suites run.
ENTRYPOINT ["/bin/sh", "-c", "set -e; if [ \"$#\" -gt 0 ]; then exec /opt/lincodex-runner-tests/isolation.test -test.v -test.count=1 \"$@\"; fi; for suite in judge isolation; do /opt/lincodex-runner-tests/$suite.test -test.v -test.count=1; done", "sandbox-test"]