Skip to content

Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.

release(v4.15.4): security fix - the image endpoint serves images only

mrbizarroe78461144b10
diff --git a/README.md b/README.md
index 0bd3b55..08a7daa 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@
</p>
-> **Current release: v4.15.3.** **Hailuo H3 on a 36-59 GB Mac, said plainly.** The H3 install card told every Mac it needed 64 GB, a number no part of Phosphene has ever required: from 36 GB, H3 runs on its compact Q8 engine, which the install builds by itself. The card now states the real floor, says when this Mac runs H3, and the **Install Hailuo H3** entry is in the Pinokio sidebar while the panel is running (it used to appear only with the panel stopped). A Mac that already has the H3 weights but not the compact engine gets a **Build Hailuo H3 compact engine** entry instead of being sent to an install button that was not there. Full notes on the [releases page](https://github.com/mrbizarro/Phosphene/releases).
+> **Current release: v4.15.4.** **Security fix: the image preview endpoint served files it should not have.** The local address Phosphene uses to show images could be asked for other files in its own folders, including the settings file that holds your saved Hugging Face, CivitAI and PostHog keys. It now serves image files only. Nothing leaves your Mac unless another program on it, or someone who can reach the panel over your network, asks for it; if you have ever exposed the panel beyond this Mac, rotate those keys. Press Update in Pinokio, then restart. Full notes on the [releases page](https://github.com/mrbizarro/Phosphene/releases).
## Overview
diff --git a/VERSION b/VERSION
index 419cdbb..614749c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.15.3
+4.15.4
diff --git a/docs/STATE.md b/docs/STATE.md
index 6dae20d..9154034 100644
--- a/docs/STATE.md
+++ b/docs/STATE.md
@@ -1,3 +1,5 @@
+> **🔒 2026-09-24 — v4.15.4: /image serves images only (security hotfix, Codex UI-01).** `panel/routes_files.py get_image` resolved the path and checked it sat under OUTPUT / UPLOADS / STATE_DIR — and served ANY file there. STATE_DIR holds `panel_settings.json` (HF token, CivitAI key, PostHog keys, which `/settings` never returns), so a local process, another local user, or anyone reaching a LAN-exposed/proxied panel could read them with one GET. A cross-origin web page could trigger the request but not read the response (no CORS headers). Fix: `IMAGE_ROUTE_EXTS` (png/jpg/jpeg/jpe/jfif/webp/gif + bmp/tif/tiff/avif/heic/heif, because the pickers accept `image/*`; **never svg** — same-origin script) checked right after the root check, before the file is opened, so the thumbnail path (w=) cannot fall back to serving the original either. Fixed first on beta branch fix416-install (f0a380a, image set widened here), ported alone onto public 4.15.3. Test `test_image_route_scope.py` (settings/queue/fleet/no-extension files 403 with and without w=, sidecar JSON in outputs/uploads 403, png/JPG/bmp/tiff still 200 from every root, svg 403, /etc/hosts 403); fails 3/6 on 4.15.3. Other path routes re-checked: /file is OUTPUT-only, /sidecar is media-suffix-gated OUTPUT/UPLOADS, /loras/download is .safetensors under the loras dir. One Codex pass (gpt-6-astra, read-only): leak closed (symlink/case/trailing-dot/double-ext/thumbnail fallback all checked); P3 .jfif/.jpe uploads would have 403d -> added; 2xP2 need a planted symlink in the thumb cache or next to an output (attacker already has file write as the user) -> not a boundary, left.
+
> **🩹 2026-09-24 — v4.15.3: Hailuo H3 on a 36-59 GB Mac, said plainly; public pinokio.js identity.** A Japanese user with a 48 GB Mac wrote on X: "Since it requires 64 GB, I couldn't even install it [H3] from the UI." Every GATE on 4.15.2 would have let that Mac install and render H3 (pinokio.js `H3_MIN_BYTES` 36e9, `h3_preflight.sh` 36e9, panel `H3_MIN_RAM_GB_Q8` 36, Q8 lane peak 25.63 GiB). Reproduced against 59d733d with a fake `sysctl` answering hw.memsize=51539607552 (48.0 GiB) on PATH, panel booted the Pinokio way: `/status.h3` = capable true, available false, needs_q8_dit true, reason not_installed — and **`size_note` = "~75 GB · needs 64 GB unified memory"**, a literal unchanged since v3.4.0 (0ef1a98) that every earlier 46→36 sweep missed. That line sits under the pitch on the H3 install card (engine switcher + the Settings card's "How to enable H3" + the Models row). Second half of the dead end: the card says "click Install Hailuo H3 in the Pinokio sidebar", and while the panel runs pinokio.js returns the Open Panel menu, which had **no H3 entry** — it existed only with the panel stopped. Third: the Settings card and `ram_note` told a Mac that never installed H3 "its low-RAM engine isn't built yet … no extra download". Fourth: a 36-59 GB Mac holding the weights but not the Q8 build was told to click "Install Hailuo H3", which pinokio.js hides once `h3_ready`. **Fixes:** `h3_size_note()` from the constants ("needs 36 GB+ … 60 GB+ also unlocks the full bf16 engine"); `h3_ram_verdict()` splits the band by `h3_paths()` the same way pinokio.js picks its one H3 entry (nothing complete → Install, weights_ok but venv/runner missing → Repair, all present but no Q8 pack → Build; all keep "on its reduced-RAM lane" so `_analytics_refusal_reason` still says h3_ram); `H3_INSTALL_MENU_TEXT` / `H3_REPAIR_MENU_TEXT` / `H3_BUILD_MENU_TEXT` quoted verbatim by pinokio.js; pinokio.js `h3Offer()` puts Install/Repair/"Build Hailuo H3 compact engine (weights kept — no re-download)" in the running AND stopped menus (build entry = h3_ready && no h3-dit-q8 pack && totalmem < 60e9); install card adds "This Mac runs it." on the q8 lane and says the entry is there while the panel runs; Settings card is an offer (download icon, no warn) unless reason is missing_q8_dit; repair card uses ram_note when missing_q8_dit (its missing-list is empty). `h3_build_q8.sh` now waits (30 s polls, 60 min cap, fail-open) while `state/panel_queue.json` has a `current` job and a panel process exists, before the quantizer and before the fresh-process `load_dit` validation — both load the whole ~20 GB Q8 DiT, and the install is now reachable mid-session (residual: a render started DURING the ~1-2 min validation is not blocked). One Codex pass (codex-cli 0.155.1, read-only): 2×P2 — the build sentence could name a Build entry the menu doesn't show when the venv/runner is broken (fixed: menu-aligned sentences + test), and install-while-rendering could stack ~20 GB on a render (fixed: the wait above). Docs: README memory row, H3_ENGINE.md bands 46→36, troubleshooting #h3-compact, preflight "LTX-2.3" → "LTX". **BETA identity:** public pinokio.js carried `title: "Phosphene BETA"` + "[BETA — unreleased builds … port 8199]" since **v4.8.2 (4e1dde6, 2026-09-01)** — the beta checkout's local edit got committed to dev and rode every promote. On Pinokio 8.2.0 users did NOT see it in the sidebar: `kernel/api meta()` and the server's folder view overlay pinokio.json's title/description (Object.assign(pinokio.js, pinokio_meta.json, pinokio.json)), and public pinokio.json says "Phosphene"; it was latent text (app search index, raw file, any Pinokio without the overlay). Restored "Phosphene" / "[MAC ONLY] …". The beta install's sidebar name comes from its own skip-worktree **pinokio.json** ("Phosphene BETA"), which nothing upstream touches. **Beta checkout note:** phosphene-dev.git has pinokio.js skip-worktree; ANY upstream pinokio.js change aborts a pull there ("Please commit your changes or stash them") — already true for the pending 3-commit ff (4.15.2 changed pinokio.js). Its working pinokio.js holds nothing local any more, so at the next panel restart: `git update-index --no-skip-worktree pinokio.js && git checkout -- pinokio.js && git merge --ff-only beta/main` (leave pinokio.json and start.js skip-worktree). New test `test_h3_48gb_install_path.py` (16: panel sentences at 48 GiB both ways, verbatim menu strings, node-evaluated pinokio.js menus on a fake installed root at 32/48/64 GB running and stopped, public identity, preflight at 48 GB via fake sysctl). Fleet read (PostHog, since 09-22): 94/132 active installs on 4.15.2, failure rate 7.8%; 48 GB is not blocked in data — H3 on 24/60 active 48 GB installs, 203 H3 renders / 1 failure; the reporter is a pre-install drop-off analytics cannot see. Open from fleet: new-install "engine venv has a Python but no packages" rose 1.8% → 7.5% (5/67; two M5 Max 128 GB never recovered) — cause not reproduced; oversized a2v on 8 GB not refused (Metal watchdog). Issues: 7 open, none an in-reach bug (#62 retrain still owed; #61/#78/#48 await reporters; #24/#63/#83 features). UI is English-only; the reporter is Japanese — noted, no i18n built.
# Phosphene — project state, history, open work
diff --git a/panel/routes_files.py b/panel/routes_files.py
index 3ce3b5f..d4f7f87 100644
--- a/panel/routes_files.py
+++ b/panel/routes_files.py
@@ -83,6 +83,16 @@ def get_file(h, parsed) -> None:
h._serve_video_with_range(path, ctype=ctype)
+#: What /image will serve. Every URL the panel mints for it points at one of
+#: these (uploads, outputs, previews, stills), and nothing secret has them.
+#: The picker takes `image/*`, so the less common raster formats a Mac hands
+#: over (BMP, TIFF, AVIF, HEIC) stay viewable as reference thumbnails. SVG is
+#: deliberately absent: opened from this origin it can run script.
+IMAGE_ROUTE_EXTS = frozenset({".png", ".jpg", ".jpeg", ".jpe", ".jfif",
+ ".webp", ".gif", ".bmp", ".tif", ".tiff", ".avif",
+ ".heic", ".heif"})
+
+
@get("/image")
def get_image(h, parsed) -> None:
qs = P.parse_qs(parsed.query)
@@ -101,6 +111,16 @@ def get_image(h, parsed) -> None:
roots = []
if not any(path.is_relative_to(r) for r in roots):
h.send_error(403); return
+ # IMAGES ONLY, checked before anything is opened. The roots above include
+ # STATE_DIR (live previews, character stills), and STATE_DIR also holds
+ # panel_settings.json — with the HF, CivitAI and PostHog keys that
+ # /settings deliberately never returns. Without this line
+ # `/image?path=<state>/panel_settings.json` answered 200 with the whole
+ # file as application/octet-stream (Codex UI-01, 2026-09-24). The same
+ # refusal covers queue, stats and every other non-image under the roots,
+ # and the thumbnail path below, which fell back to the original on error.
+ if path.suffix.lower() not in IMAGE_ROUTE_EXTS:
+ h.send_error(403); return
if not path.exists() or not path.is_file():
h.send_error(404); return
# Optional thumbnail resize. Mr Bizarro 2026-05-20 diag: the
@@ -130,7 +150,10 @@ def get_image(h, parsed) -> None:
served_ext = served.suffix.lower()
ctype = {
".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg",
- ".webp": "image/webp", ".gif": "image/gif",
+ ".jpe": "image/jpeg", ".jfif": "image/jpeg",
+ ".webp": "image/webp", ".gif": "image/gif", ".bmp": "image/bmp",
+ ".tif": "image/tiff", ".tiff": "image/tiff", ".avif": "image/avif",
+ ".heic": "image/heic", ".heif": "image/heif",
}.get(served_ext, "application/octet-stream")
h.send_response(200)
h.send_header("Content-Type", ctype)
diff --git a/test_image_route_scope.py b/test_image_route_scope.py
new file mode 100644
index 0000000..feb9f82
--- /dev/null
+++ b/test_image_route_scope.py
@@ -0,0 +1,121 @@
+"""/image serves images, and only images (Codex UI-01, 2026-09-24).
+
+The route's roots include STATE_DIR because live previews and character stills
+live there. STATE_DIR also holds panel_settings.json, whose HF / CivitAI /
+PostHog keys `/settings` is careful never to return. Before the fix
+`/image?path=<state>/panel_settings.json` answered 200 with the raw file.
+Every fixture below lives in a temp dir — never the real state.
+"""
+from __future__ import annotations
+
+import io
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+from unittest import mock
+from urllib.parse import quote, urlparse
+
+ROOT = Path(__file__).resolve().parent
+sys.path.insert(0, str(ROOT))
+
+import mlx_ltx_panel as panel # noqa: E402
+
+routes_files = sys.modules["panel.routes_files"]
+
+
+class _Handler:
+ def __init__(self):
+ self.status = None
+ self.wfile = io.BytesIO()
+
+ def send_error(self, code, *a):
+ self.status = code
+
+ def send_response(self, code):
+ self.status = code
+
+ def send_header(self, *a):
+ pass
+
+ def end_headers(self):
+ pass
+
+ def _inline_filename(self, path):
+ return Path(path).name
+
+
+class ImageRouteScope(unittest.TestCase):
+ def setUp(self):
+ self.tmp = tempfile.TemporaryDirectory()
+ root = Path(self.tmp.name)
+ self.state, self.out, self.up = root / "state", root / "out", root / "up"
+ for d in (self.state, self.out, self.up):
+ d.mkdir()
+ self._patches = [mock.patch.object(panel, "STATE_DIR", self.state),
+ mock.patch.object(panel, "OUTPUT", self.out),
+ mock.patch.object(panel, "UPLOADS", self.up),
+ mock.patch.object(panel, "push", lambda *a, **k: None)]
+ for p in self._patches:
+ p.start()
+
+ def tearDown(self):
+ for p in reversed(self._patches):
+ p.stop()
+ self.tmp.cleanup()
+
+ def _get(self, path: Path, w: str = "") -> _Handler:
+ h = _Handler()
+ url = "/image?path=" + quote(str(path)) + (f"&w={w}" if w else "")
+ routes_files.get_image(h, urlparse(url))
+ return h
+
+ def test_settings_and_other_state_files_are_refused(self):
+ secret = b'{"hf_token":"FAKE_TEST_SECRET"}'
+ for name in ("panel_settings.json", "image_engine.json", "fleet.jsonl",
+ "queue.json", "noext"):
+ f = self.state / name
+ f.write_bytes(secret)
+ for w in ("", "480"):
+ h = self._get(f, w)
+ self.assertEqual(h.status, 403, (name, w))
+ self.assertNotIn(b"FAKE_TEST_SECRET", h.wfile.getvalue())
+
+ def test_non_images_in_outputs_and_uploads_are_refused(self):
+ for d in (self.out, self.up):
+ f = d / "clip.mp4.json"
+ f.write_bytes(b"{}")
+ self.assertEqual(self._get(f).status, 403)
+
+ def test_real_images_still_serve_from_every_root(self):
+ from PIL import Image
+ for d in (self.state / "live", self.out, self.up):
+ d.mkdir(exist_ok=True)
+ f = d / "still.png"
+ Image.new("RGB", (32, 16), (200, 10, 10)).save(f)
+ h = self._get(f)
+ self.assertEqual(h.status, 200, d)
+ self.assertTrue(h.wfile.getvalue().startswith(b"\x89PNG"))
+ f2 = d / "Still.JPG"
+ Image.new("RGB", (32, 16)).save(f2, "JPEG")
+ self.assertEqual(self._get(f2).status, 200)
+
+ def test_less_common_raster_uploads_still_serve(self):
+ from PIL import Image
+ for ext, fmt in ((".bmp", "BMP"), (".tiff", "TIFF"), (".jfif", "JPEG"),
+ (".jpe", "JPEG")):
+ f = self.up / f"ref{ext}"
+ Image.new("RGB", (32, 16), (10, 200, 10)).save(f, fmt)
+ self.assertEqual(self._get(f).status, 200, ext)
+
+ def test_svg_is_not_an_image_here(self):
+ f = self.up / "x.svg"
+ f.write_bytes(b"<svg xmlns='http://www.w3.org/2000/svg'><script>1</script></svg>")
+ self.assertEqual(self._get(f).status, 403)
+
+ def test_outside_the_roots_is_still_refused(self):
+ self.assertEqual(self._get(Path("/etc/hosts")).status, 403)
+
+
+if __name__ == "__main__":
+ unittest.main()