Repository navigation
unsloth eval: refuse a network-share base model named by a Hub adapter - #19014
Merged
Merged
Conversation
…ork share resolve_base_model reads base_model_name_or_path from a Hub adapter's adapter_config.json and hands it to lm-eval (hf / vllm) or AutoConfig before FastLanguageModel's own guard (#18923) runs. On Windows a UNC value makes the host open an SMB connection to a server the repo chose. Refuse it with the same rule; local adapter folders and an explicit --base-model are unchanged.
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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. Nice work! 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
to Imagineer99/unsloth
that referenced
this pull request
Nov 23, 2026
…export MoE probe (unslothai#19060) Two more places where a Hub repo's adapter config can point a load at a Windows network share (`\\host\share\...`), which makes Windows authenticate to that host and leak the user's NTLM hash. Same class as unslothai#18923 and unslothai#19014. - **Clef adapters (`unsloth/models/decision.py`)**: the Hub repo is downloaded to a local snapshot folder first, so the loader's `_refuse_network_share_adapter_base` saw a local folder and skipped the check. `_load_clef` now runs that helper against the Hub `model_name` for both the decision config `base_model` and the adapter config `base_model_name_or_path`. - **Studio export MoE probe (`GET /api/export/moe-info`)**: for a Hub LoRA the route read the base from the repo's `adapter_config.json` and probed it (`Path.exists()`, a `config.json` read). It now returns 400 for a network-share base using Studio's existing `is_network_share`, before any filesystem call. Local adapter folders and paths the user types are left alone, and nothing changes on Linux / macOS. An export of such an adapter already failed in the loader guard (unslothai#18923), so no working flow is lost. Tests: `tests/test_clef_adapter_unc_base_guard.py` and `studio/backend/tests/test_export_moe_info_unc_base.py` (Windows flag forced; fail on main, pass here).
yermakoffivan
pushed a commit
to yermakoffivan/unsloth
that referenced
this pull request
Nov 23, 2026
…ransformers routes (unslothai#19101) Two more places where a Hub repo's metadata reached a Windows filesystem probe as a UNC path before any check (same class as unslothai#18923, unslothai#19014, unslothai#19060): - **`UNSLOTH_PARALLEL=auto` sizing (`parallel_auto.py`)**: a Hub adapter's `base_model_name_or_path` went to `get_model_name` and `_checkpoint_tensors` (`os.path.isdir`). It now runs the loader's existing `_refuse_network_share_adapter_base` right after reading the base. - **sentence-transformers Router routes**: `modules.json` folders were already refused when they leave the model, but Router route keys from `router_config.json` were joined onto the folder and probed. That rule is now a shared helper (`_folder_escapes_model`), applied to Hub routes too: UNC, absolute, drive and `..`-escaping routes are refused. Local folders and normal routes are unchanged. Tests: `tests/test_parallel_auto.py`, `tests/test_sentence_transformer_route_unc.py`.
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.
unsloth evalresolves the base model of a Hub adapter from itsadapter_config.jsonand passesbase_model_name_or_pathto lm-eval, vLLM orAutoConfig. On Windows a UNC value such as\\host\share\modelmakes that load open an SMB connection to a host the repo author chose, which sends the user's NTLM hash. The Python loaders already refuse this (#18923), but the hf and vllm eval backends never go through them.The CLI now refuses a network-share base named by a Hub adapter right after resolving it, with exit code 2 and a message to pass
--base-model. It uses the same rule asunsloth_zoo.vision_utils._is_network_share, kept import-free because the hf and vllm backends do not import unsloth. Local adapter folders, an explicit--base-model, normal Hub bases, and Linux / macOS are unchanged.Test:
unsloth_cli/tests/test_eval_unc_adapter_base.py(Windows flag forced).