feat(nsjail): make rlimit_fsize configurable per worker (NSJAIL_RLIMIT_FSIZE_MB) (#12609)

python3, ansible and dbt nsjail run configs hard-code rlimit_fsize: 1000, so a
jailed job cannot write any single file larger than 1000 MiB, even with a
disk-backed /tmp (nsjail_tmp_backing=disk) and plenty of worker disk. Jobs that
download multi-GB files (e.g. a 1.75 GB CSV) fail, while the same job works
under unshare.

Add NSJAIL_RLIMIT_FSIZE_MB (worker env, read at startup): MiB, or
unlimited/none/inf/0 for rlimit_fsize_type: INF. Unset keeps 1000 MiB. Reuses
the rlimit_as renderer, now generic over the field name. Total space stays
bounded by the /tmp tmpfs size or, when disk-backed, the worker's disk.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-11-23 22:26:39 +01:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 1fb70c4fab
commit e6d9ff8f95
9 changed files with 73 additions and 23 deletions
+10 -6
View File
@@ -153,18 +153,18 @@ use windmill_object_store::get_cache_object_store;
use crate::{
check_no_network_jailed,
common::{
build_command_with_isolation, create_args_and_out_file, get_reserved_variables, read_file,
read_result, render_nsjail_rlimit_as, resolve_nsjail_timeout,
proto_str, resolve_nsjail_tmp_mount_block, start_child_process, OccupancyMetrics,
StreamNotifier, DEV_CONF_NSJAIL,
build_command_with_isolation, create_args_and_out_file, get_reserved_variables, proto_str,
read_file, read_result, render_nsjail_rlimit_as, render_nsjail_rlimit_fsize,
resolve_nsjail_timeout, resolve_nsjail_tmp_mount_block, start_child_process,
OccupancyMetrics, StreamNotifier, DEV_CONF_NSJAIL,
},
get_proxy_envs_for_lang, get_run_proxy_envs,
handle_child::handle_child,
is_sandboxing_enabled, nsjail_clone_newnet, read_ee_registry,
worker_utils::ping_job_status,
PyV, DISABLE_NUSER, HOME_ENV, INDEX_CERT, NATIVE_CERT, NSJAIL_AVAILABLE, NSJAIL_PATH,
NSJAIL_PY_RLIMIT_AS_MB, PATH_ENV, PIP_EXTRA_INDEX_URL, PIP_INDEX_URL, PROXY_ENVS,
PY_INSTALL_DIR, TRACING_PROXY_CA_CERT_PATH, TRUSTED_HOST, TZ_ENV, UV_CACHE_DIR,
NSJAIL_PY_RLIMIT_AS_MB, NSJAIL_RLIMIT_FSIZE_MB, PATH_ENV, PIP_EXTRA_INDEX_URL, PIP_INDEX_URL,
PROXY_ENVS, PY_INSTALL_DIR, TRACING_PROXY_CA_CERT_PATH, TRUSTED_HOST, TZ_ENV, UV_CACHE_DIR,
UV_EXCLUDE_NEWER, UV_HTTP_TIMEOUT, UV_INDEX_STRATEGY, UV_PYTHON_INSTALL_MIRROR,
};
use windmill_common::client::AuthedClient;
@@ -1173,6 +1173,10 @@ mount {{
"{RLIMIT_AS}",
&render_nsjail_rlimit_as(NSJAIL_PY_RLIMIT_AS_MB.as_deref(), 4096),
)
.replace(
"{RLIMIT_FSIZE}",
&render_nsjail_rlimit_fsize(NSJAIL_RLIMIT_FSIZE_MB.as_deref(), 1000),
)
.replace("{JOB_DIR}", job_dir)
.replace("{PY_INSTALL_DIR}", &*PY_INSTALL_DIR)
.replace("{CLONE_NEWUSER}", &(!*DISABLE_NUSER).to_string())