Repository navigation
Refuse a Hub adapter base on a Windows network share in Clef and the export MoE probe - #19060
Merged
Merged
Conversation
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.
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. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. 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". |
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.
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.unsloth/models/decision.py): the Hub repo is downloaded to a local snapshot folder first, so the loader's_refuse_network_share_adapter_basesaw a local folder and skipped the check._load_clefnow runs that helper against the Hubmodel_namefor both the decision configbase_modeland the adapter configbase_model_name_or_path.GET /api/export/moe-info): for a Hub LoRA the route read the base from the repo'sadapter_config.jsonand probed it (Path.exists(), aconfig.jsonread). It now returns 400 for a network-share base using Studio's existingis_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.pyandstudio/backend/tests/test_export_moe_info_unc_base.py(Windows flag forced; fail on main, pass here).