Repository navigation
Studio: install the dataset image URL guard when datasets loads, not at startup - #14888
Merged
Merged
Conversation
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
danielhanchen
added a commit
that referenced
this pull request
Oct 23, 2026
…sion harness (#14903) ## Summary `TestFormatConversionNoTorchVenv` (4 tests, Python 3.12 and 3.13) fails on main, so Backend CI is red on every PR: ``` File "<string>", line 10, in <module> ImportError: attempted relative import with no known parent package ``` The harness execs `format_conversion.py` as a standalone script and rewrites its relative imports (`.cells`, `.iterable`, `.format_detection`) to top-level ones. #14701 added `from .remote_images import fetch_untrusted_image_bytes, is_network_share` on line 10, which the harness does not rewrite. ## Change Rewrite `from .remote_images import` the same way as `.cells` in the four exec snippets. `remote_images.py` imports only the standard library at module level, so it loads in the no-torch venv. Test-only change. ## Testing - `tests/python/test_studio_import_no_torch.py` on main: 4 failed. With this change: 29 passed. - With #14888's `remote_images.py` (guard installed on datasets import) in place: 29 passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#14701 routes dataset image URLs through the SSRF-guarded fetch by patching
datasets.Image.decode_example. It applies that patch with a module-levelinstall_guarded_image_decode()call inutils/datasets/remote_images.py, which runsfrom datasets import config. That module is on the startup import path:So every Unsloth Studio and Desktop start loads
datasets,pandasandpyarrow(andtorchin CI). On main this failstest_startup_defers_torch.py(4 tests), and the Startup profile job fails its budget: 8.123 s median to a healthy port against 8.0 s.Change
The guard itself is unchanged. Only when it is installed changes:
datasets.features.imageis already imported, it is patched immediately, as before.utils/security/hub_data_files.pyuses.install_guarded_image_decode()keeps its name and idempotence. It now takes the module as an optional argument, so it can patch from inside the loader. The finder is inserted once.Testing
test_guard_applies_when_datasets_loads_after_this_moduleruns in a subprocess. It importsremote_imagesfirst and assertsdatasetswas not loaded, then importsdatasets.features.imageand assertsdecode_exampleis guarded.studio/backend/tests: 2598 passed, 34 skipped.import mainwall time, 5 runs each on the same machine: main 9.07 (cold), 6.36, 6.07, 6.26, 6.34 s; this branch 6.12, 6.12, 5.72, 5.70, 5.54 s.