Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: ask for a password on a raw `-H 0.0.0.0` bind too
danielhanchen70127b2d2e7c
diff --git a/studio/backend/auth/terminal_prompt.py b/studio/backend/auth/terminal_prompt.pyindex 988a857ca46..4a39b1205fc 100644--- a/studio/backend/auth/terminal_prompt.py+++ b/studio/backend/auth/terminal_prompt.py@@ -191,15 +191,25 @@ def _read_password(prompt: str, *, out: "TextIO | None" = None) -> str:def should_prompt_password_change(- *, tunnel_will_start: bool, requires_change: bool, stdin_isatty: bool, stderr_isatty: bool+ *, tunnel_will_start: bool, requires_change: bool, stdin_isatty: bool,+ stderr_isatty: bool, bind_is_exposed: bool = False,) -> bool:"""Whether to block startup on an interactive terminal password change.- True only when the tunnel is actually about to start, the admin still has- the seeded password, and both stdin and stderr are real terminals (headless- launches keep the bootstrap-timeout protection instead of hanging).+ True when the launch puts the web UI where others can reach it, the admin+ still has the seeded password, and both stdin and stderr are real terminals+ (headless launches keep the bootstrap-timeout protection instead of hanging).++ Two ways to be reachable, not one. ``tunnel_will_start`` is the public+ Cloudflare URL. ``bind_is_exposed`` is a raw non-loopback bind such as+ ``-H 0.0.0.0``, which is reachable by every host on the network, and by the+ internet when the machine has a public address, yet starts no tunnel. That+ second case previously got no prompt at all, so the seeded password stayed+ live and was served in the page to anyone who loaded it."""- return tunnel_will_start and requires_change and stdin_isatty and stderr_isatty+ if not (tunnel_will_start or bind_is_exposed):+ return False+ return requires_change and stdin_isatty and stderr_isattydef prompt_for_password_change(@@ -209,17 +219,23 @@ def prompt_for_password_change(apply_change: Callable[[str], None],username: str = "unsloth",out: "TextIO | None" = None,+ exposure: str = "on the public internet",) -> bool:- """Force a new admin password before public exposure; True on success.+ """Force a new admin password before exposure; True on success.Loops until a valid, confirmed password is committed via ``apply_change``.Ctrl-C / EOF returns False; the caller must then abort the launch.++ ``exposure`` names where this launch will be reachable. A tunnel really is+ the public internet; a raw ``-H 0.0.0.0`` bind is every network interface,+ which is the LAN behind a NAT router and the internet on a cloud box with a+ public address. Claiming the wrong one trains people to ignore the message."""if out is None:out = sys.stderrout.write("\n"- "Unsloth Studio will be exposed on the public internet, so set a\n"+ f"Unsloth Studio will be reachable {exposure}, so set a\n""password now. Ctrl+C to abort.\n\n")out.flush()diff --git a/studio/backend/run.py b/studio/backend/run.pyindex e090e39478d..c00500cd029 100644--- a/studio/backend/run.py+++ b/studio/backend/run.py@@ -2164,7 +2164,26 @@ def _terminal_password_gate((api-only, timeout 0) nothing protects it, so refuse. NOT wrapped in a broadtry/except: an auth storage failure must abort rather than expose the default."""- if not tunnel_will_start:+ from auth.bootstrap_timeout import _is_exposed_bind++ # A raw non-loopback bind (-H 0.0.0.0) starts no tunnel, so it used to skip+ # this gate entirely even though the docstring above describes exactly its+ # hazard: the served HTML injects the bootstrap credential, and every host on+ # the network can load it. Scoped like the bootstrap deadline: web UI only,+ # never api-only (authenticates by API key, not the admin password) and never+ # Colab (sandboxed, no inbound).+ # secure = False deliberately. _is_exposed_bind counts --secure as exposed+ # because for a tunnel launch the tunnel IS the exposure, but --secure forces+ # a loopback bind, so asking it with secure = True would conflate "the tunnel+ # publishes this" with "the socket itself is reachable". Here only the second+ # question matters; the first is already tunnel_will_start.+ bind_is_exposed = (+ _is_exposed_bind(host, False)+ and frontend_served+ and not api_only+ and not is_colab+ )+ if not tunnel_will_start and not bind_is_exposed:return True, Falsefrom auth import hashing as _auth_hashing@@ -2187,10 +2206,19 @@ def _terminal_password_gate(if not should_prompt_password_change(tunnel_will_start = tunnel_will_start,+ bind_is_exposed = bind_is_exposed,requires_change = requires_change,stdin_isatty = _stream_isatty(sys.stdin),stderr_isatty = _stream_isatty(sys.stderr),):+ # Headless raw bind: leave it EXACTLY as it behaved before this gate+ # learned about non-tunnel exposure. The refuse-and-strip handling below+ # is calibrated to publishing a public URL; applying it here would break+ # long-running headless containers, which are the common use of+ # -H 0.0.0.0, and would delete the .bootstrap_password file such a+ # deployment is often read from. The bootstrap deadline still arms.+ if not tunnel_will_start:+ return True, False# No terminal: only proceed if the bootstrap deadline will arm; api-only# and TIMEOUT=0 never arm it, leaving the default credential public.deadline_arms = should_arm_bootstrap_timeout(@@ -2250,6 +2278,10 @@ def _terminal_password_gate(is_current_password = _is_current_password,apply_change = _apply_change,out = sys.stderr,+ exposure = (+ "on the public internet" if tunnel_will_start+ else "on every network interface"+ ),)return (True, True) if changed else (False, False)diff --git a/studio/backend/tests/test_password_prompt.py b/studio/backend/tests/test_password_prompt.pyindex 1af88360650..1b99f1f4c34 100644--- a/studio/backend/tests/test_password_prompt.py+++ b/studio/backend/tests/test_password_prompt.py@@ -338,3 +338,113 @@ def test_resolve_supplied_password_off_by_default(monkeypatch):monkeypatch.delenv(tp.SUPPLIED_PASSWORD_ENV, raising = False)assert tp.resolve_supplied_password("") is Noneassert tp.resolve_supplied_password(None) is None+++# ──────────────────────────────────────────────────────────────────────+# A raw non-loopback bind is exposure too.+#+# `-H 0.0.0.0` starts no tunnel, so it used to return False here and skip the+# gate entirely, leaving the seeded admin password live and served in the page+# to every host on the network. The gate's own docstring in run.py described+# that hazard while the code returned early on `if not tunnel_will_start`.+# ──────────────────────────────────────────────────────────────────────+++def test_a_raw_exposed_bind_prompts_when_a_terminal_is_attached():+ from auth.terminal_prompt import should_prompt_password_change++ assert should_prompt_password_change(+ tunnel_will_start = False,+ bind_is_exposed = True,+ requires_change = True,+ stdin_isatty = True,+ stderr_isatty = True,+ ) is True+++def test_a_raw_exposed_bind_stays_silent_without_a_terminal():+ """Headless raw binds keep today's behaviour, deliberately.++ Everything downstream of a True here is calibrated to publishing a public+ URL: it refuses to launch when the deadline is disabled, and it deletes+ .bootstrap_password. Long-running headless containers are the common use of+ -H 0.0.0.0 and are often logged into by reading exactly that file, so they+ keep the bootstrap deadline as their protection instead.+ """+ from auth.terminal_prompt import should_prompt_password_change++ for stdin_tty, stderr_tty in ((False, False), (True, False), (False, True)):+ assert should_prompt_password_change(+ tunnel_will_start = False,+ bind_is_exposed = True,+ requires_change = True,+ stdin_isatty = stdin_tty,+ stderr_isatty = stderr_tty,+ ) is False+++def test_a_loopback_launch_is_untouched():+ """Plain `unsloth studio` must be completely unaffected."""+ from auth.terminal_prompt import should_prompt_password_change++ assert should_prompt_password_change(+ tunnel_will_start = False,+ bind_is_exposed = False,+ requires_change = True,+ stdin_isatty = True,+ stderr_isatty = True,+ ) is False+++def test_an_already_changed_password_never_prompts():+ from auth.terminal_prompt import should_prompt_password_change++ assert should_prompt_password_change(+ tunnel_will_start = True,+ bind_is_exposed = True,+ requires_change = False,+ stdin_isatty = True,+ stderr_isatty = True,+ ) is False+++def test_the_default_keeps_old_callers_tunnel_only():+ """bind_is_exposed defaults False, so an old caller behaves as before."""+ from auth.terminal_prompt import should_prompt_password_change++ assert should_prompt_password_change(+ tunnel_will_start = False,+ requires_change = True,+ stdin_isatty = True,+ stderr_isatty = True,+ ) is False+++def test_the_prompt_banner_does_not_claim_the_internet_for_a_lan_bind(monkeypatch):+ """`-H 0.0.0.0` behind a NAT router is the LAN, not the public internet.++ Saying "public internet" there is false often enough to train people to+ ignore the message, which is the one thing this prompt cannot afford.+ """+ import io++ from auth import terminal_prompt++ def _no_input(*_a, **_k):+ raise EOFError++ monkeypatch.setattr(terminal_prompt, "_read_password", _no_input)++ out = io.StringIO()+ # The read aborts immediately and returns False, which is fine: the banner+ # is written before any read.+ terminal_prompt.prompt_for_password_change(+ min_length = 8,+ is_current_password = lambda _c: False,+ apply_change = lambda _p: None,+ out = out,+ exposure = "on every network interface",+ )+ text = out.getvalue()+ assert "on every network interface" in text+ assert "public internet" not in textdiff --git a/studio/backend/tests/test_password_prompt_backstop.py b/studio/backend/tests/test_password_prompt_backstop.pyindex ef4179e5743..07e0771a438 100644--- a/studio/backend/tests/test_password_prompt_backstop.py+++ b/studio/backend/tests/test_password_prompt_backstop.py@@ -188,7 +188,7 @@ def test_gate_success_applies_route_equivalent_change(monkeypatch):lambda u, p, **kw: calls.append(("update", u, p, kw)),)- def _fake_prompt(*, min_length, is_current_password, apply_change, out):+ def _fake_prompt(*, min_length, is_current_password, apply_change, out, **_kw):# The gate wires the policy constant and route-equivalent apply hook.assert min_length == auth_storage.MIN_PASSWORD_LENGTH# Wired to the real hash comparison: a wrong guess is rejected.@@ -409,3 +409,90 @@ def test_apply_supplied_password_strips_env_even_when_literal_wins(monkeypatch):monkeypatch.setenv(terminal_prompt.SUPPLIED_PASSWORD_ENV, "env-should-be-stripped")run._apply_supplied_password("literal-new-password")assert terminal_prompt.SUPPLIED_PASSWORD_ENV not in run.os.environ+++# ──────────────────────────────────────────────────────────────────────+# The gate now covers a raw exposed bind, not just the tunnel.+# ──────────────────────────────────────────────────────────────────────+++_RAW_BIND_KWARGS = dict(+ host = "0.0.0.0",+ secure = False,+ api_only = False,+ frontend_served = True,+)+++def test_a_headless_raw_bind_is_byte_for_byte_unchanged(monkeypatch):+ """The compatibility promise of this change.++ Headless `-H 0.0.0.0` is the long-running container case. It must still+ proceed, still keep serving the bootstrap credential, and above all must not+ reach the strip-and-refuse handling that a public tunnel launch uses; that+ would delete the .bootstrap_password such deployments are logged into with.+ """+ _patch_streams(monkeypatch, tty = False)+ _patch_seeded_admin(monkeypatch, requires_change = True)+ assert run._terminal_password_gate(+ tunnel_will_start = False, **_RAW_BIND_KWARGS+ ) == (True, False)+++def test_a_raw_bind_with_a_terminal_reaches_the_prompt(monkeypatch):+ """The fix. Before this, `if not tunnel_will_start` returned first."""+ _patch_streams(monkeypatch, tty = True)+ _patch_seeded_admin(monkeypatch, requires_change = True)++ seen = {}++ def _fake_prompt(*, min_length, is_current_password, apply_change, out, **kw):+ seen.update(kw)+ apply_change("a-brand-new-password")+ return True++ from auth import terminal_prompt+ monkeypatch.setattr(terminal_prompt, "prompt_for_password_change", _fake_prompt)++ assert run._terminal_password_gate(+ tunnel_will_start = False, **_RAW_BIND_KWARGS+ ) == (True, True)+ # And it must not tell a LAN operator they are on the public internet.+ assert seen.get("exposure") == "on every network interface"+++def test_a_loopback_launch_still_short_circuits(monkeypatch):+ """Plain `unsloth studio` must not consult storage at all."""+ def _boom(*_a, **_k):+ raise AssertionError("storage must not be consulted for a loopback launch")++ monkeypatch.setattr(run, "_stream_isatty", lambda _s: True)+ from auth import storage as _storage+ monkeypatch.setattr(_storage, "ensure_default_admin", _boom)++ assert run._terminal_password_gate(+ tunnel_will_start = False,+ host = "127.0.0.1",+ secure = False,+ api_only = False,+ frontend_served = True,+ ) == (True, False)+++def test_api_only_and_colab_raw_binds_do_not_prompt(monkeypatch):+ """Scoped like the bootstrap deadline: web UI only, never api-only or Colab."""+ def _boom(*_a, **_k):+ raise AssertionError("storage must not be consulted")++ monkeypatch.setattr(run, "_stream_isatty", lambda _s: True)+ from auth import storage as _storage+ monkeypatch.setattr(_storage, "ensure_default_admin", _boom)++ assert run._terminal_password_gate(+ tunnel_will_start = False, host = "0.0.0.0", secure = False,+ api_only = True, frontend_served = True,+ ) == (True, False)+ assert run._terminal_password_gate(+ tunnel_will_start = False, host = "0.0.0.0", secure = False,+ api_only = False, frontend_served = True, is_colab = True,+ ) == (True, False)diff --git a/unsloth_cli/commands/studio.py b/unsloth_cli/commands/studio.pyindex 71537eba2b9..54c7faf5333 100644--- a/unsloth_cli/commands/studio.py+++ b/unsloth_cli/commands/studio.py@@ -1170,14 +1170,20 @@ def _create_desktop_secret_in_cli() -> str:conn.close()-def _should_prompt_password_change(+def _launch_publishes_tunnel(*, cloudflare: Optional[bool], host: str, secure: bool, api_only: bool) -> bool:- """Whether this launch will expose Unsloth through the Cloudflare tunnel.+ """Whether this launch will publish Unsloth through the Cloudflare tunnel.++ CLI mirror of run.py's _cloudflare_tunnel_should_start, minus the Colab case+ (Colab launches never come through this CLI path). --secure implies the+ tunnel; --cloudflare only tunnels non-api-only wildcard binds.- CLI mirror of run.py's _cloudflare_tunnel_should_start, minus the Colab- case (Colab launches never come through this CLI path). --secure implies- the tunnel; --cloudflare only tunnels non-api-only wildcard binds.+ Kept separate from _should_prompt_password_change, which is deliberately+ wider. The guards that key off THIS one exist because a headless tunnel+ launch strips .bootstrap_password and could lock the admin out; a raw+ wildcard bind never strips, so widening them would add failure modes that+ protect nothing."""if secure:return True@@ -1188,6 +1194,40 @@ def _should_prompt_password_change(return is_wildcard_host(host) and not api_only+def _should_prompt_password_change(+ *, cloudflare: Optional[bool], host: str, secure: bool, api_only: bool+) -> bool:+ """Whether this launch puts Unsloth where someone else can reach it.++ CLI mirror of run.py's gate, minus the Colab case (Colab launches never come+ through this CLI path). --secure implies the tunnel; --cloudflare only+ tunnels non-api-only wildcard binds.++ A raw wildcard bind counts too, and only when a terminal is attached. It is+ reachable by every host on the network, and by the internet on a machine+ with a public address, while starting no tunnel, so it previously got no+ prompt, no warning and no strip: the seeded admin password stayed live and+ was served in the page to anyone who loaded it.++ The interactivity condition is deliberate and is what keeps this safe to+ ship. Everything downstream of here is calibrated to publishing a public+ URL: it refuses to launch when the deadline is disabled and it deletes+ .bootstrap_password. Applying that to headless -H 0.0.0.0 would break+ long-running containers, which are the common use of the flag. Headless raw+ binds therefore keep exactly today's behaviour, protected by the bootstrap+ deadline; only a launch with a human present is asked to set a password.+ """+ if secure:+ return True+ from unsloth_cli._tool_policy import is_wildcard_host++ if not is_wildcard_host(host) or api_only:+ return False+ if cloudflare is True:+ return True+ return _prompt_streams_interactive()++def _prompt_streams_interactive() -> bool:"""The prompt needs a real terminal for input and for the masked echo."""try:@@ -1394,7 +1434,7 @@ def _require_servable_frontend_or_exit(index.html) or the auto-resolved built dist. Returns `frontend` unchanged fornon-public or --api-only launches (no login page needed)."""- if api_only or not _should_prompt_password_change(+ if api_only or not _launch_publishes_tunnel(cloudflare = cloudflare, host = host, secure = secure, api_only = api_only):return frontend@@ -1436,7 +1476,7 @@ def _validate_inproc_backend_before_strip(on that path and exit cleanly if broken, before anything is stripped.Headless-only so an interactive prompt is not delayed behind the import."""- if not _should_prompt_password_change(+ if not _launch_publishes_tunnel(cloudflare = cloudflare, host = host, secure = secure, api_only = api_only):return@@ -1543,6 +1583,15 @@ def _enforce_password_change_before_exposure(cloudflare = cloudflare, host = host, secure = secure, api_only = api_only):return+ # Only a tunnel launch is genuinely "a public Cloudflare URL". A raw wildcard+ # bind is every network interface, which is the LAN behind a NAT router and+ # the internet on a cloud box. Naming the wrong one in an error trains people+ # to ignore it, and would be plainly wrong for `unsloth studio -H 0.0.0.0`.+ tunnel_will_start = secure or cloudflare is True+ exposure = (+ "on a public Cloudflare URL" if tunnel_will_start+ else "on every network interface"+ )# Before public exposure we must PROVE the admin password is no longer the# seeded default. If we cannot (auth DB won't open, or a fresh admin cannot be# seeded + committed below), an old studio-venv child could regenerate a fresh@@ -1556,7 +1605,7 @@ def _enforce_password_change_before_exposure(# Refuse rather than risk a child serving the default login; a transient# lock clears on retry.typer.echo(- "Error: refusing to publish Unsloth on a public Cloudflare URL: could "+ f"Error: refusing to expose Unsloth {exposure}: could "f"not open the Unsloth auth database ({exc}) to confirm the admin ""password was changed. Retry (a transient database lock clears), or ""change the password first (run `unsloth studio` locally with a "@@ -1582,7 +1631,7 @@ def _enforce_password_change_before_exposure(except OSError:passtyper.echo(- "Error: refusing to publish Unsloth on a public Cloudflare URL: could "+ f"Error: refusing to expose Unsloth {exposure}: could "f"not initialize the admin account ({exc}), so a re-exec'd Unsloth ""child could regenerate and serve a default credential. Retry (a ""transient database lock clears), or change the password first (run "@@ -1692,7 +1741,7 @@ def _enforce_password_change_before_exposure()typer.echo(- "Unsloth Studio will be exposed on the public internet, so set a "+ f"Unsloth Studio will be reachable {exposure}, so set a ""password now. Ctrl+C to abort.",err = True,)diff --git a/unsloth_cli/tests/test_studio_password_prompt.py b/unsloth_cli/tests/test_studio_password_prompt.pyindex 1761afc04e9..2c14b036ec9 100644--- a/unsloth_cli/tests/test_studio_password_prompt.py+++ b/unsloth_cli/tests/test_studio_password_prompt.py@@ -37,30 +37,79 @@ _NEW_PW = "brand-new-password"# ── pure trigger matrix ──────────────────────────────────────────────+_TUNNEL_MATRIX = [+ # --secure always implies the tunnel (host already forced to loopback).+ (None, "127.0.0.1", True, False, True),+ (True, "127.0.0.1", True, False, True),+ (None, "127.0.0.1", True, True, True),+ # --cloudflare tunnels only non-api-only wildcard binds.+ (True, "0.0.0.0", False, False, True),+ (True, "::", False, False, True),+ (True, "::0", False, False, True),+ (True, "0:0:0:0:0:0:0:0", False, False, True),+ (True, "0", False, False, True),+ (True, "::ffff:0.0.0.0", False, False, True),+ (True, "", False, False, False),+ (True, "127.0.0.1", False, False, False),+ (True, "0.0.0.0", False, True, False),+ # Off/unset never starts a tunnel without --secure.+ (None, "0.0.0.0", False, False, False),+ (False, "0.0.0.0", False, False, False),+ (None, "127.0.0.1", False, False, False),+]++[email protected]("cloudflare,host,secure,api_only,expected", _TUNNEL_MATRIX)+def test_launch_publishes_tunnel_matrix(cloudflare, host, secure, api_only, expected):+ """The narrow predicate. Unchanged, and pinned so it stays that way.++ The strip-and-lockout guards key off this one. A raw wildcard bind never+ strips .bootstrap_password, so it must not be pulled in here even though it+ does now prompt.+ """+ assert (+ _studio()._launch_publishes_tunnel(+ cloudflare = cloudflare, host = host, secure = secure, api_only = api_only+ )+ is expected+ )++@pytest.mark.parametrize(- "cloudflare,host,secure,api_only,expected",+ "cloudflare,host,secure,api_only,interactive,expected",[- # --secure always implies the tunnel (host already forced to loopback).- (None, "127.0.0.1", True, False, True),- (True, "127.0.0.1", True, False, True),- (None, "127.0.0.1", True, True, True),- # --cloudflare tunnels only non-api-only wildcard binds.- (True, "0.0.0.0", False, False, True),- (True, "::", False, False, True),- (True, "::0", False, False, True),- (True, "0:0:0:0:0:0:0:0", False, False, True),- (True, "0", False, False, True),- (True, "::ffff:0.0.0.0", False, False, True),- (True, "", False, False, False),- (True, "127.0.0.1", False, False, False),- (True, "0.0.0.0", False, True, False),- # Off/unset never prompts without --secure.- (None, "0.0.0.0", False, False, False),- (False, "0.0.0.0", False, False, False),- (None, "127.0.0.1", False, False, False),+ # Every tunnel launch prompts regardless of the terminal; the headless+ # fallback is handled downstream, not here.+ *[(c, h, s, a, False, e) for c, h, s, a, e in _TUNNEL_MATRIX if e],+ *[(c, h, s, a, True, e) for c, h, s, a, e in _TUNNEL_MATRIX if e],+ # The change: a RAW wildcard bind with a terminal attached. Reachable by+ # every host on the network with the seeded password live, and it starts+ # no tunnel, so before this it got no prompt at all.+ (None, "0.0.0.0", False, False, True, True),+ (False, "0.0.0.0", False, False, True, True),+ (None, "::", False, False, True, True),+ (None, "0", False, False, True, True),+ (None, "::ffff:0.0.0.0", False, False, True, True),+ # Headless raw binds stay exactly as they were: no prompt, no strip, no+ # refusal. Long-running containers are the common use of this flag and+ # the bootstrap deadline is what covers them.+ (None, "0.0.0.0", False, False, False, False),+ (False, "0.0.0.0", False, False, False, False),+ (None, "::", False, False, False, False),+ # --api-only authenticates by API key, not the admin password.+ (None, "0.0.0.0", False, True, True, False),+ # Loopback is not exposed, so nothing changes for plain `unsloth studio`.+ (None, "127.0.0.1", False, False, True, False),+ (None, "localhost", False, False, True, False),+ (None, "", False, False, True, False),],)-def test_should_prompt_password_change_matrix(cloudflare, host, secure, api_only, expected):+def test_should_prompt_password_change_matrix(+ monkeypatch, cloudflare, host, secure, api_only, interactive, expected+):+ monkeypatch.setattr(+ _studio(), "_prompt_streams_interactive", lambda: interactive+ )assert (_studio()._should_prompt_password_change(cloudflare = cloudflare, host = host, secure = secure, api_only = api_only@@ -694,7 +743,7 @@ def test_studio_default_connect_failure_fails_closed(monkeypatch, tmp_path):assert "exec" not in kinds, eventsassert result.exit_code == 1, result.outputcombined = (result.output or "") + (getattr(result, "stderr", "") or "")- assert "refusing to publish" in combined.lower()+ assert "refusing to expose" in combined.lower()# Not stripped: a retry can still prompt/strip once the lock clears.assert bootstrap_file.exists()@@ -717,7 +766,7 @@ def test_studio_default_seed_commit_failure_fails_closed(monkeypatch, tmp_path):assert "exec" not in kinds, eventsassert result.exit_code == 1, result.outputcombined = (result.output or "") + (getattr(result, "stderr", "") or "")- assert "refusing to publish" in combined.lower()+ assert "refusing to expose" in combined.lower()# The half-written seed file is stripped, and no admin row was committed.assert not (tmp_path / "auth" / studio_mod.BOOTSTRAP_PASSWORD_FILE).exists()verify = sqlite3.connect(_auth_db(tmp_path))