From 1f99dee027d6b93cc8de5673590ee91d1b61853c Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 13 Mar 2026 08:37:43 -0700 Subject: [PATCH] fix(seed): disable remote code execution in seed inspect dataset loads (#4275) * fix(seed): disable remote code execution for seed inspect loads * fix(test): use __file__-relative path in seed test The test used a CWD-relative path (`studio/backend/routes/...`) which only resolved when pytest was invoked from the repo root. Use `Path(__file__).resolve()` so the test passes regardless of CWD. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Test Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- studio/backend/routes/data_recipe/seed.py | 1 + studio/backend/tests/test_data_recipe_seed.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 studio/backend/tests/test_data_recipe_seed.py diff --git a/studio/backend/routes/data_recipe/seed.py b/studio/backend/routes/data_recipe/seed.py index 76e05be954..1765550adc 100644 --- a/studio/backend/routes/data_recipe/seed.py +++ b/studio/backend/routes/data_recipe/seed.py @@ -118,6 +118,7 @@ def _build_stream_load_kwargs( "path": dataset_name, "split": split, "streaming": True, + "trust_remote_code": False, } if data_file: kwargs["data_files"] = [data_file] diff --git a/studio/backend/tests/test_data_recipe_seed.py b/studio/backend/tests/test_data_recipe_seed.py new file mode 100644 index 0000000000..601df8bbfe --- /dev/null +++ b/studio/backend/tests/test_data_recipe_seed.py @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0 + +from pathlib import Path + + +def test_seed_inspect_load_kwargs_disables_remote_code_execution(): + seed_route = ( + Path(__file__).resolve().parent.parent / "routes" / "data_recipe" / "seed.py" + ).read_text() + + assert '"trust_remote_code": False' in seed_route