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

+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
# Runs the A16 hostile-program suite on a runner host from the bundle built by
# make -C runner a16-bundle. It needs root on that host (namespaces, user
# mapping, and the delegated cgroup), the runner's nsjail, Python, and Go
# tool directory at the paths of the runner configuration, and an empty work
# directory. It never contacts the network and writes only the report and
# the work directory.
#
# Usage: sudo sh run-a16.sh [report.json]
# Settings come from the same RUNNER_* variables as the runner service,
# for example RUNNER_CGROUP_ROOT, RUNNER_WORK_DIR, and RUNNER_GO_TOOL_DIR.
set -eu
bundle=$(cd "$(dirname "$0")" && pwd)
report=${1:-$bundle/a16-report-$(date -u +%Y%m%dT%H%M%SZ).json}
if [ "$(id -u)" != "0" ]; then
echo "run-a16.sh: run as root on the runner host" >&2
exit 2
fi
export RUNNER_HOSTILE_FIXTURES="$bundle/testdata/hostile"
export RUNNER_A16_REPORT="$report"
# A non-zero status means that at least one case failed: practice must stay
# disabled until a run passes.
"$bundle/isolation.test" -test.v -test.count=1 -test.run '^TestA16'
echo "A16 report: $report"