Skip to content

Refuse a Hub adapter base on a Windows network share in Clef and the export MoE probe - #19060

Merged
danielhanchen merged 2 commits into
mainfrom
s1123a/U1/unc-adapter-base
Nov 23, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
s1123a/U1/unc-adapter-base

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

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 #18923 and #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 (#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).

A Hub Clef repo resolves to a local snapshot folder, so FastModel's
_refuse_network_share_adapter_base check sees a local path and skips. Run
the same helper in _load_clef on both the decision config base_model and the
adapter_config base_model_name_or_path, keyed on the Hub id. Local adapter
folders stay the user's own choice.
/api/export/moe-info follows a Hub LoRA's adapter_config.json to its base
and probes it as a local path (Path.exists, config.json read), which on
Windows authenticates to a host the repo chose. Refuse a UNC base with the
existing utils.datasets.remote_images.is_network_share check.
@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-23T12:22:59.407919Z e641bfb 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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: e641bfb866

ℹ️ 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 ca5a9e7 into main Nov 23, 2026
@danielhanchen
danielhanchen deleted the s1123a/U1/unc-adapter-base branch November 23, 2026 13:34
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