Skip to content

unsloth eval: refuse a network-share base model named by a Hub adapter - #19014

Merged
danielhanchen merged 1 commit into
mainfrom
s1122d/U1/eval-unc-adapter-base
Nov 23, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
s1122d/U1/eval-unc-adapter-base

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

unsloth eval resolves the base model of a Hub adapter from its adapter_config.json and passes base_model_name_or_path to lm-eval, vLLM or AutoConfig. On Windows a UNC value such as \\host\share\model makes 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 as unsloth_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).

…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.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T07:02:58.345447Z 9e5a13a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 9e5a13a80a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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
danielhanchen merged commit 201792b into main Nov 23, 2026
@danielhanchen
danielhanchen deleted the s1122d/U1/eval-unc-adapter-base branch November 23, 2026 08:47
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant