Skip to content

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.

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 flags take precedence over config.json:

Terminal window
judge execute-code --permissive \
--language python \
--code 'while True: pass' \
--cpu-time 1 \
--wall-time 3 \
--memory 64

The HTTP service reads these at startup. All have sensible defaults.

VariableDefaultWhat it does
RUSTBOX_HOST0.0.0.0Bind address
RUSTBOX_PORT3000Listen port
RUSTBOX_WORKERS4Concurrent sandbox workers
RUSTBOX_API_KEY(none)Require this key in x-api-key header
RUSTBOX_MAX_CODE_BYTES65536Maximum source code size
RUSTBOX_MAX_STDIN_BYTES65536Maximum stdin payload
RUSTBOX_SYNC_WAIT_TIMEOUT30Seconds before ?wait=true times out
RUSTBOX_WEBHOOK_TIMEOUT5Seconds for webhook HTTP delivery
RUSTBOX_ALLOW_LOCALHOST_WEBHOOKSfalseAllow http://localhost webhook URLs (dev mode)
DATABASE_URLsqlite://rustbox.dbSQLite (default) or PostgreSQL connection string

Seccomp filtering is on by default. The built-in deny-list blocks 18 dangerous syscalls.

Terminal window
# Disable seccomp (not recommended)
judge execute-code --no-seccomp --language python --code '...'
# Use a custom policy file
judge execute-code --seccomp-policy /path/to/policy.json --language python --code '...'

The default deny-list:

SyscallActionWhy
io_uring_*ENOSYSBypass seccomp entirely
ptraceKILLDebug/inspect other processes
process_vm_*KILLRead/write other process memory
bpfKILLLoad kernel modules
mount, umount2KILLModify filesystem
rebootKILLSelf-explanatory
kexec_*KILLLoad new kernel
init_module, delete_moduleKILLKernel module manipulation
pivot_root, chrootKILLEscape sandbox filesystem