test(runner): verify sandbox isolation with a hostile program suite
This commit is contained in:
1 parent
afee564bf4
commit
e858280d91
38 files changed
+1359
-168
No files matched your search
+356
-46
@@ -1,91 +1,401 @@
|
||||
{
|
||||
"schema": "lincodex.runner-hostile-fixtures/v1",
|
||||
"description": "Programs that a sandbox run must stop or contain. Each case runs as one public group with one test; expect.limit is the termination limit, or empty when the program ends by itself.",
|
||||
"schema": "lincodex.runner-hostile-fixtures/v2",
|
||||
"description": "A16 hostile-program suite. Every case runs as one public group with one test under default_limits. expect.limit is the termination limit or empty when the program ends by itself; expect.signal, when present, is the signal that must stop it (31 is SIGSYS from the seccomp policy). Probe programs print one word when every attempt was refused.",
|
||||
"default_limits": {
|
||||
"time_limit_ms": 1000,
|
||||
"memory_limit_mb": 64,
|
||||
"output_limit_kb": 64
|
||||
},
|
||||
"categories": {
|
||||
"baseline": "A correct program still works, and a syntax error stops before any test.",
|
||||
"network": "TCP, UDP, listening, DNS, raw, packet, and netlink sockets are refused.",
|
||||
"files_and_secrets": "Host files, runner files, the API token, procfs, sysfs, and secret environment variables are invisible; root, source, and build output are read-only.",
|
||||
"privileges": "The program is not root and cannot setuid, setgid, chown to root, or raise rlimits.",
|
||||
"escape": "ptrace, mount (including a fresh procfs), and unshare are killed by seccomp.",
|
||||
"processes": "Fork and thread bombs are stopped by the cgroup process limit.",
|
||||
"memory": "Memory exhaustion is stopped by the cgroup memory limit.",
|
||||
"disk": "Disk exhaustion is refused by the file size limit and the scratch tmpfs size.",
|
||||
"output": "Endless output is stopped by the output limit.",
|
||||
"timeout": "Busy loops, ignored signals, idle waits, and detached daemons do not outlive the time limits or the run."
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"name": "correct_sum",
|
||||
"name": "py_correct_sum",
|
||||
"category": "baseline",
|
||||
"language": "python3",
|
||||
"source": "python/sum_correct.py",
|
||||
"input": "1 2 3\n",
|
||||
"expected_output": "6\n",
|
||||
"expect": {"outcome": "accepted", "limit": ""}
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "syntax_error",
|
||||
"name": "py_syntax_error",
|
||||
"category": "baseline",
|
||||
"language": "python3",
|
||||
"source": "python/syntax_error.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {"outcome": "compile_error", "limit": ""}
|
||||
"expect": {
|
||||
"outcome": "compile_error",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "infinite_loop",
|
||||
"name": "py_infinite_loop",
|
||||
"category": "timeout",
|
||||
"language": "python3",
|
||||
"source": "python/infinite_loop.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {"outcome": "time_limit_exceeded", "limit": "cpu_time"}
|
||||
"expect": {
|
||||
"outcome": "time_limit_exceeded",
|
||||
"limit": "cpu_time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sleep_forever",
|
||||
"language": "python3",
|
||||
"source": "python/sleep_forever.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {"outcome": "time_limit_exceeded", "limit": "wall_time"}
|
||||
},
|
||||
{
|
||||
"name": "memory_leak",
|
||||
"language": "python3",
|
||||
"source": "python/memory_leak.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {"outcome": "memory_limit_exceeded", "limit": "memory"}
|
||||
},
|
||||
{
|
||||
"name": "huge_output",
|
||||
"language": "python3",
|
||||
"source": "python/huge_output.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {"outcome": "output_limit_exceeded", "limit": "output"}
|
||||
},
|
||||
{
|
||||
"name": "fork_bomb",
|
||||
"language": "python3",
|
||||
"source": "python/fork_bomb.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {"outcome": "runtime_error", "limit": "processes"}
|
||||
},
|
||||
{
|
||||
"name": "network_probe",
|
||||
"name": "py_network",
|
||||
"category": "network",
|
||||
"language": "python3",
|
||||
"source": "python/network_probe.py",
|
||||
"input": "",
|
||||
"expected_output": "blocked\n",
|
||||
"expect": {"outcome": "accepted", "limit": ""}
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "filesystem_probe",
|
||||
"name": "py_files_and_secrets",
|
||||
"category": "files_and_secrets",
|
||||
"language": "python3",
|
||||
"source": "python/filesystem_probe.py",
|
||||
"input": "",
|
||||
"expected_output": "isolated\n",
|
||||
"expect": {"outcome": "accepted", "limit": ""}
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "privilege_probe",
|
||||
"name": "py_privileges",
|
||||
"category": "privileges",
|
||||
"language": "python3",
|
||||
"source": "python/privilege_probe.py",
|
||||
"input": "",
|
||||
"expected_output": "unprivileged\n",
|
||||
"expect": {"outcome": "accepted", "limit": ""}
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "py_ptrace",
|
||||
"category": "escape",
|
||||
"language": "python3",
|
||||
"source": "python/ptrace_attach.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "runtime_error",
|
||||
"limit": "",
|
||||
"signal": 31
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "py_mount_proc",
|
||||
"category": "escape",
|
||||
"language": "python3",
|
||||
"source": "python/mount_proc.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "runtime_error",
|
||||
"limit": "",
|
||||
"signal": 31
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "py_unshare_user",
|
||||
"category": "escape",
|
||||
"language": "python3",
|
||||
"source": "python/unshare_user.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "runtime_error",
|
||||
"limit": "",
|
||||
"signal": 31
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "py_fork_bomb",
|
||||
"category": "processes",
|
||||
"language": "python3",
|
||||
"source": "python/fork_bomb.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "runtime_error",
|
||||
"limit": "processes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "py_memory_leak",
|
||||
"category": "memory",
|
||||
"language": "python3",
|
||||
"source": "python/memory_leak.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "memory_limit_exceeded",
|
||||
"limit": "memory"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "py_disk_fill",
|
||||
"category": "disk",
|
||||
"language": "python3",
|
||||
"source": "python/disk_fill.py",
|
||||
"input": "",
|
||||
"expected_output": "refused\n",
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "py_huge_output",
|
||||
"category": "output",
|
||||
"language": "python3",
|
||||
"source": "python/huge_output.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "output_limit_exceeded",
|
||||
"limit": "output"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "py_ignore_signals",
|
||||
"category": "timeout",
|
||||
"language": "python3",
|
||||
"source": "python/ignore_signals.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "time_limit_exceeded",
|
||||
"limit": "cpu_time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "py_sleep_forever",
|
||||
"category": "timeout",
|
||||
"language": "python3",
|
||||
"source": "python/sleep_forever.py",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "time_limit_exceeded",
|
||||
"limit": "wall_time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "py_orphan_daemon",
|
||||
"category": "timeout",
|
||||
"language": "python3",
|
||||
"source": "python/orphan_daemon.py",
|
||||
"input": "",
|
||||
"expected_output": "parent done\n",
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_correct_sum",
|
||||
"category": "baseline",
|
||||
"language": "go",
|
||||
"source": "go/sum_correct.go",
|
||||
"input": "1 2 3\n",
|
||||
"expected_output": "6\n",
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_network",
|
||||
"category": "network",
|
||||
"language": "go",
|
||||
"source": "go/network_probe.go",
|
||||
"input": "",
|
||||
"expected_output": "blocked\n",
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_files_and_secrets",
|
||||
"category": "files_and_secrets",
|
||||
"language": "go",
|
||||
"source": "go/filesystem_probe.go",
|
||||
"input": "",
|
||||
"expected_output": "isolated\n",
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_privileges",
|
||||
"category": "privileges",
|
||||
"language": "go",
|
||||
"source": "go/privilege_probe.go",
|
||||
"input": "",
|
||||
"expected_output": "unprivileged\n",
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_ptrace",
|
||||
"category": "escape",
|
||||
"language": "go",
|
||||
"source": "go/ptrace_attach.go",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "runtime_error",
|
||||
"limit": "",
|
||||
"signal": 31
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_mount_proc",
|
||||
"category": "escape",
|
||||
"language": "go",
|
||||
"source": "go/mount_proc.go",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "runtime_error",
|
||||
"limit": "",
|
||||
"signal": 31
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_unshare_user",
|
||||
"category": "escape",
|
||||
"language": "go",
|
||||
"source": "go/unshare_user.go",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "runtime_error",
|
||||
"limit": "",
|
||||
"signal": 31
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_fork_bomb",
|
||||
"category": "processes",
|
||||
"language": "go",
|
||||
"source": "go/fork_bomb.go",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "runtime_error",
|
||||
"limit": "processes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_memory_leak",
|
||||
"category": "memory",
|
||||
"language": "go",
|
||||
"source": "go/memory_leak.go",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "memory_limit_exceeded",
|
||||
"limit": "memory"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_disk_fill",
|
||||
"category": "disk",
|
||||
"language": "go",
|
||||
"source": "go/disk_fill.go",
|
||||
"input": "",
|
||||
"expected_output": "refused\n",
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_huge_output",
|
||||
"category": "output",
|
||||
"language": "go",
|
||||
"source": "go/huge_output.go",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "output_limit_exceeded",
|
||||
"limit": "output"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_ignore_signals",
|
||||
"category": "timeout",
|
||||
"language": "go",
|
||||
"source": "go/ignore_signals.go",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "time_limit_exceeded",
|
||||
"limit": "cpu_time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_sleep_forever",
|
||||
"category": "timeout",
|
||||
"language": "go",
|
||||
"source": "go/sleep_forever.go",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "time_limit_exceeded",
|
||||
"limit": "wall_time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_orphan_daemon",
|
||||
"category": "timeout",
|
||||
"language": "go",
|
||||
"source": "go/orphan_daemon.go",
|
||||
"input": "",
|
||||
"expected_output": "parent done\n",
|
||||
"expect": {
|
||||
"outcome": "accepted",
|
||||
"limit": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "go_thread_bomb",
|
||||
"category": "processes",
|
||||
"language": "go",
|
||||
"source": "go/thread_bomb.go",
|
||||
"input": "",
|
||||
"expected_output": "",
|
||||
"expect": {
|
||||
"outcome": "runtime_error",
|
||||
"limit": "processes"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user