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 <test@test.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
88c7b08faa
commit
1f99dee027
2 changed files with 13 additions and 0 deletions
|
|
@ -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]
|
||||
|
|
|
|||
12
studio/backend/tests/test_data_recipe_seed.py
Normal file
12
studio/backend/tests/test_data_recipe_seed.py
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue