Skip to content

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.

Studio: revealing a chat's sandbox folder is owner-only (#15512)

Daniel Hanca29b722fdda
diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py
index 9c29fc543d6..b1042544948 100644
--- a/studio/backend/routes/inference.py
+++ b/studio/backend/routes/inference.py
@@ -34706,13 +34706,12 @@ async def reveal_sandbox_dir(
backend runs on the user's own machine, which is the desktop app.
"""
await _authenticate_header_or_query(request, token)
+ # Like open: it drives the host's desktop, so only its owner may.
+ account_access.require_installation_owner()
from starlette.concurrency import run_in_threadpool
if file:
- # Like open: it drives the host's desktop, so only its owner may.
- account_access.require_installation_owner()
-
from pathlib import Path
from utils.paths.path_utils import reveal_in_file_manager
diff --git a/studio/backend/tests/test_sandbox_reveal_owner_only.py b/studio/backend/tests/test_sandbox_reveal_owner_only.py
new file mode 100644
index 00000000000..bd727f8ef78
--- /dev/null
+++ b/studio/backend/tests/test_sandbox_reveal_owner_only.py
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+"""Revealing a chat's sandbox folder drives the host's file manager, so only the owner may."""
+
+from __future__ import annotations
+
+import asyncio
+import sys
+from pathlib import Path
+
+import pytest
+from fastapi import HTTPException
+
+BACKEND = Path(__file__).resolve().parents[1]
+if str(BACKEND) not in sys.path:
+ sys.path.insert(0, str(BACKEND))
+
+import routes.inference as inf # noqa: E402
+import utils.paths.path_utils as path_utils # noqa: E402
+from hub.services.models import account_access # noqa: E402
+
+
+def _wire(monkeypatch, tmp_path, managed):
+ launched = []
+
+ async def _auth(request, token):
+ return "user"
+
+ monkeypatch.setattr(inf, "_authenticate_header_or_query", _auth)
+ monkeypatch.setattr(account_access, "managed_account", lambda: managed)
+ monkeypatch.setattr(inf, "_sandbox_dir_for", lambda s, create = False: str(tmp_path))
+ monkeypatch.setattr(path_utils, "reveal_in_file_manager", lambda p, **k: launched.append(p))
+ return launched
+
+
+def test_a_managed_account_cannot_open_the_folder_on_the_owners_desktop(tmp_path, monkeypatch):
+ launched = _wire(monkeypatch, tmp_path, managed = True)
+ with pytest.raises(HTTPException) as refused:
+ asyncio.run(inf.reveal_sandbox_dir("s1", request = None))
+ assert refused.value.status_code == 403
+ assert launched == []
+
+
+def test_the_owner_still_opens_the_folder(tmp_path, monkeypatch):
+ launched = _wire(monkeypatch, tmp_path, managed = False)
+ assert asyncio.run(inf.reveal_sandbox_dir("s1", request = None))["status"] == "ok"
+ assert len(launched) == 1