Default Studio host to 127.0.0.1 and prompt before auto-start#5267
Merged
Conversation
Studio bound to 0.0.0.0 by default and the installer silently auto-started a server at end of install, exposing it on the network without consent and contradicting the privacy-first / local-only guarantee. - studio/backend/run.py: run_server() and argparse --host default to 127.0.0.1 - unsloth_cli/commands/studio.py: studio_default() and run() --host default to 127.0.0.1 - install.sh: drop -H 0.0.0.0 from generated launcher template; replace silent auto-start with a [Y/n] prompt; add cloud/network note to manual hint - install.ps1: drop -H 0.0.0.0 from PowerShell launcher template; replace silent auto-start with a Read-Host [Y/n] prompt; add cloud/network note - studio/setup.sh: drop -H 0.0.0.0 from launch hint; add cloud/network note - README.md: simplify launch examples to `unsloth studio -p 8888`; note -H 0.0.0.0 is available for cloud/LAN use Tests: - studio/backend/tests/test_host_defaults.py - tests/studio/test_cli_studio_defaults.py - tests/sh/test_install_host_defaults.sh
Contributor
There was a problem hiding this comment.
Code Review
This pull request changes the default host binding for Unsloth Studio from 0.0.0.0 to 127.0.0.1 across the backend, CLI, and installation scripts to ensure a "privacy-first" local experience. Documentation and setup scripts have been updated to reflect this change, including new interactive prompts in the installers and instructions for users who require network access. Additionally, new tests using AST parsing have been added to verify these defaults. I have no feedback to provide.
Author
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
Resolves #4684 and supersedes #4864.
Credit to @Bedrovelsen for initially raising the issue and writing the original fix in #4864. This PR carries the same goals forward and is rebased onto current
mainto clear thestudio/backend/run.pyconflict that #4864 picked up asmainevolved (notably the addition of--api-onlyandllama_parallel_slotstorun.py's argparse handling).Studio previously bound to
0.0.0.0(all interfaces) by default, and the installer silently auto-started a server at the end of install — exposing the service on the network without user consent and contradicting the documented privacy-first / 100% local guarantee.Changes
studio/backend/run.py:run_server()and argparse--hostdefault to127.0.0.1. (No_make_argument_parser()extraction, since main has since added--api-only/llama_parallel_slotsto that block — the default-value change alone meets the security goal.)unsloth_cli/commands/studio.py: typer--hostdefault to127.0.0.1in bothstudio_default()andrun()(theunsloth studio runone-liner). security: default Studio host to 127.0.0.1 and prompt before auto-start #4864 only touched the first.install.sh: drop-H 0.0.0.0from the generated~/.local/share/unsloth/launch-studio.shtemplate; replace silent auto-start with a[Y/n]prompt; add a(add -H 0.0.0.0 to allow network / cloud access)note in the manual hint.install.ps1: drop-H 0.0.0.0from the PowerShell launcher template; replace silent auto-start with aRead-Host [Y/n]prompt; same note.studio/setup.sh: drop-H 0.0.0.0from the post-setuplaunch:hint and add the cloud/network note. (Not in security: default Studio host to 127.0.0.1 and prompt before auto-start #4864 — without this, the post-setup hint contradicted the new default.)README.md: simplify Launch examples tounsloth studio -p 8888; add a note that-H 0.0.0.0is available for cloud/LAN use.-p 8888is kept in user-visible hints since it documents the default port (only-H 0.0.0.0is the security concern being removed).Users who need all-interfaces binding (cloud VMs, LAN sharing) can still pass
-H 0.0.0.0explicitly.Tauri impact
None. Both installers exit on the
--tauriearly-return well before the auto-start prompt block, and the Tauri runtime path uses--api-only(Tauri parses theTAURI_PORT={port}line and connects via127.0.0.1regardless of bind host). Desktop shortcuts (.desktop/.lnk/.app) now invokeunsloth studioand bind loopback by default — correct desktop behaviour.Tests (TDD)
studio/backend/tests/test_host_defaults.py— AST inspection ofrun_server()parameter default and argparse--hostdefault. Walks the whole module so the assertions hold whether the parser lives in__main__or a helper.tests/studio/test_cli_studio_defaults.py— AST inspection of the typerOptiondefault for bothstudio_default()andrun().tests/sh/test_install_host_defaults.sh— static analysis ofinstall.sh,install.ps1,studio/setup.sh, andREADME.md.Test plan
./install.sh --local→ prompt appears, Enter launches Studio bound to127.0.0.1:8888,nprints manual hint and exits cleanly.unsloth studio(no flags) binds to127.0.0.1:8888.unsloth studio -H 0.0.0.0 -p 8888still binds to all interfaces.--tauri) skips the prompt and finishes as before. Notified Mugi. Mugi to adjustpytest studio/backend/tests/test_host_defaults.py tests/studio/test_cli_studio_defaults.pypasses.bash tests/sh/test_install_host_defaults.shpasses.