Configuration
rustbox uses a layered configuration system. Defaults come from config.json, CLI flags override them, and the judge-service reads environment variables on top.
config.json
Section titled “config.json”Lives at the project root. Defines per-language resource limits, environment variables, and compilation settings.
{ "languages": { "python": { "memory_limit_mb": 128, "cpu_time_limit_secs": 4, "wall_time_limit_secs": 7, "max_processes": 10, "command": ["python3", "-c"], "environment": { "PYTHONDONTWRITEBYTECODE": "1" } }, "cpp": { "memory_limit_mb": 256, "cpu_time_limit_secs": 8, "wall_time_limit_secs": 10, "max_processes": 8, "compile_command": ["g++", "-O2", "-std=c++17", "-o"], "run_command": ["./solution"] } }}CLI overrides
Section titled “CLI overrides”CLI flags take precedence over config.json:
judge execute-code --permissive \ --language python \ --code 'while True: pass' \ --cpu-time 1 \ --wall-time 3 \ --memory 64Judge-service environment variables
Section titled “Judge-service environment variables”The HTTP service reads these at startup. All have sensible defaults.
| Variable | Default | What it does |
|---|---|---|
RUSTBOX_HOST | 0.0.0.0 | Bind address |
RUSTBOX_PORT | 3000 | Listen port |
RUSTBOX_WORKERS | 4 | Concurrent sandbox workers |
RUSTBOX_API_KEY | (none) | Require this key in x-api-key header |
RUSTBOX_MAX_CODE_BYTES | 65536 | Maximum source code size |
RUSTBOX_MAX_STDIN_BYTES | 65536 | Maximum stdin payload |
RUSTBOX_SYNC_WAIT_TIMEOUT | 30 | Seconds before ?wait=true times out |
RUSTBOX_WEBHOOK_TIMEOUT | 5 | Seconds for webhook HTTP delivery |
RUSTBOX_ALLOW_LOCALHOST_WEBHOOKS | false | Allow http://localhost webhook URLs (dev mode) |
DATABASE_URL | sqlite://rustbox.db | SQLite (default) or PostgreSQL connection string |
Seccomp configuration
Section titled “Seccomp configuration”Seccomp filtering is on by default. The built-in deny-list blocks 18 dangerous syscalls.
# Disable seccomp (not recommended)judge execute-code --no-seccomp --language python --code '...'
# Use a custom policy filejudge execute-code --seccomp-policy /path/to/policy.json --language python --code '...'The default deny-list:
| Syscall | Action | Why |
|---|---|---|
io_uring_* | ENOSYS | Bypass seccomp entirely |
ptrace | KILL | Debug/inspect other processes |
process_vm_* | KILL | Read/write other process memory |
bpf | KILL | Load kernel modules |
mount, umount2 | KILL | Modify filesystem |
reboot | KILL | Self-explanatory |
kexec_* | KILL | Load new kernel |
init_module, delete_module | KILL | Kernel module manipulation |
pivot_root, chroot | KILL | Escape sandbox filesystem |