Skip to content

OpenBox 3.1.0: Hardened Rust Core, Cleaner Tree

Latest

Choose a tag to compare

@github-actions github-actions released this 01 Dec 19:11

OpenBox 3.1.0: Hardened Rust Core, Cleaner Tree

OpenBox 3.1.0 hardens the native Rust server across security, concurrency, HTTP streaming, session lifecycle, and platform parity, wires background automation and window flags directly into openbox-server, and consolidates the repository layout while keeping your existing 3.0 and 2.x library 100% compatible.

If 3.0.0 moved the backend from Python to native Rust, 3.1.0 finishes the daemon wiring and closes edge cases under real desktop workloads. Scheduled maintenance, durable media downloads, pause-aware playtime accounting, Windows shell launching and process suspension, macOS tool PATH resolution, FTS5 SQLite search, and lazy file streaming all tighten up without changing library.json or breaking any /api/v2 contract.

Tip

Drop-in upgrade for OpenBox 3.0 and 2.x users: Install 3.1.0 over your existing copy and open it. Your library.json (schema 7), box art, saves, Save Vault snapshots, settings, themes, and playlists load untouched with zero migration and zero re-scraping.

Full changelog: CHANGELOG.md | Code diff: v3.0.0...v3.1.0 | Coming from 1.x? Read upgrade-3.0.md

At a Glance: What Changed in 3.1.0

  • Lazy 64 KiB streaming and non-blocking HTTP dispatch: Media and asset downloads stream in 64 KiB async chunks instead of buffering full files in RAM, while synchronous handlers across all 417 endpoints run on Tokio's blocking pool under a 30-second timeout.
  • Full daemon lifecycle and CLI flags in openbox-server: Native openbox-server now runs the durable media download worker, startup and shutdown commands, hourly maintenance sweeps, structured tracing-subscriber logging, graceful HTTP/SSE/webhook draining, and --app-window, --no-app-window, --bigbox, --resolution, and --backup --keep <n> flags.
  • FTS5 SQLite search and deadlock-free state recovery: SqliteReadModel auto-enables at 5,000+ games, uses a single persistent Condvar rebuild worker, and runs games_fts MATCH with bm25 ranking and an escaped LIKE fallback instead of scanning full JSON blobs. JsonStateStore unifies lock ordering across recover() and schema-6-to-7 migration.
  • Library projection and integrity check parity: Fixed missing-path store_installed and playable status on projected game cards (project_game) and restored {severity, count, examples} category objects plus live save_vault totals in /api/v2/library/integrity and --check-library.
  • Pause-accurate playtime and live session recaps: Double-launch races are blocked with an atomic "starting" reservation, paused time is subtracted from recorded playtime, session recaps include live screenshot counts, RetroAchievements deltas, and Quick Resume availability, and restarted servers reattach watchers to running games.
  • Windows, macOS, and Linux platform fixes: Direct Win32 ShellExecuteW launching, real Windows process-tree pause/resume, .dll libretro core detection, \\?\ extended/UNC path normalization, macOS Homebrew/MacPorts PATH setup, typed macOS libproc structs, and process-group timeout termination across external tools.
  • Consolidated repository layout (ADR 0117): Moved 28 flat runtime Python modules into app/, native host sources into native/, packaging metadata into packaging/, and shell scripts into scripts/, with matching macOS bundle and Windows installer path updates.

Native Rust Server: Security, Concurrency, and API Parity

Every layer of the 15-crate Rust workspace received targeted hardening and Python-oracle parity fixes:

  • Streaming media and Range/ETag parity: send_file uses lazy 64 KiB async streaming (Body::from_stream) so large videos and manuals stay off the heap. If-None-Match accepts weak W/ ETags and *, and malformed Range headers return 400 RANGE_PARSE_ERROR.
  • Non-blocking route dispatch and duplicate elimination: Synchronous GET and POST route handlers offload to Tokio's blocking pool with a 30-second REQUEST_TIMEOUT (504 REQUEST_TIMEOUT on timeout), matching async external handlers (/api/v2/netplay/lobby and /api/v2/emulators/defs/*). Removed a duplicate /api/v2/steam/action match in imports.rs and verified zero shadowed handlers across all 417 routes (413 /api/v2/* plus 4 /api/host/*).
  • Stricter HTTP boundaries and error parity: Host validation rejects malformed loopback headers (localhost:evil, [::1]evil, port 0) while accepting bracketed [::1]:port. Query token parameters are redacted from RFC 9457 instance fields, non-GET/POST requests return 405 METHOD_NOT_ALLOWED with Allow: GET, POST, static/locale routes reject backslashes, NUL bytes, and dot segments with canonicalize root containment, and AuthRateLimiter prunes expired entries once 256 IPs are tracked.
  • Restored endpoint parity: /api/v2/highscores now reads per-game scores (read_local_highscores) instead of scanning the home folder, /api/v2/emulators/dependencies runs real detect_dependencies, /api/v2/emulators/settings GET and POST expose and validate plugin-declared emulator_settings sections, /api/v2/launch/audit returns {"scanned": false, "job": null} when unscanned, /api/v2/theme-asset returns 404 HTTP_404 when missing, and strict game lookup (400 BAD_REQUEST) guards favorite, progress, rating, memories, screenshot, clips, metadata, and saves/add mutations.
  • Missing-path projection and integrity report parity: project_game now computes store_installed (checking path_exists and install_dir when both steam_app_id and install_dir are set, otherwise falling back to path_exists) and playable (!manual_entry and store_installed for store-backed entries) to match Python when paths are missing on disk, keeping steam_installable and steam_repairable accurate. check_library now emits {severity, count, examples} category objects (preserving full counts while capping examples at 20, mapping library_root_missing tokens with raw {gid}: {p} examples, and checking Unix game_path_unreadable permissions) as expected by static/library_storage.js, and both /api/v2/library/integrity and openbox-server --check-library populate live save_vault totals via vault_summary_readonly.
  • Deadlock-free state store and FTS5 read model: JsonStateStore::load_readonly_locked removes the read/reindex lock gap, respects frozen libraries, fsyncs .bak temp files, and keeps thread_lock and file_lock unified through recover() and migrate_primary_to_v7(). SqliteReadModel sets PRAGMA busy_timeout=5000, exposes live pending and rebuilding flags on its persistent Condvar worker (750 ms debounce, 5,000 ms max wait), and queries games_fts MATCH with bm25 ordering plus a bounded SQL LIKE ... ESCAPE '\' fallback.
  • Daemon scheduler, SSE, jobs, and shutdown drain: openbox-server starts the durable media download queue worker, runs startup_commands and shutdown_commands, and executes startup plus hourly maintenance ticks (tray recent games, due Time Capsules, scheduled health scans and launch audits, auto-backups, auto Save Vault passes, and Deal Radar refreshes). JobManager exempts continuous auto-import jobs from foreground worker permits, prunes history/cancel maps, and falls back to OS threads off-runtime. SseHub strips CR/LF in broadcast JSON, keeps slow subscribers connected when queues fill, and validates game_id before reading RA caches. On shutdown, the server closes SSE streams, drains active connections and in-flight webhooks for up to 2 seconds, stops running sessions, emits plugin app_shutdown, cleans up server.port/server.token, and drains the optional strangler Python proxy (which now reads startup output on a 20-second helper thread and preserves multi-value response headers).
  • SSRF, archive, backup, and Gameyfin hardening: External requests use typed HttpRequestOpts (fixing swapped timeout/byte-cap arguments in updates and plugin catalog fetches) and a pooled client (POOLED_PUBLIC_CLIENT) with .no_proxy(). SSRF validation blocks ::a.b.c.d, 0100::/64, Teredo (2001::/32), 2001:2::/48, and 2001:20::/28, validates redirect targets, and runs async DNS checks on webhook targets (validate_webhook_async). Zip extraction checks cumulative max_total_bytes, deletes partial over-limit files, rejects case-insensitive duplicate entry names on Windows and macOS, and serializes 7z extraction under a file lock and timeout. Backup and save restores enforce 32 GiB total and 4 GiB per-member limits (1 MiB manifest limit). Gameyfin sanitizes Content-Disposition filenames, uses .no_proxy(), parses Content-Type case-insensitively, and re-authenticates only on HTTP 401 or 403.
  • Identity, rounding, sync, and UTF-8 safety: stable_game_id treats empty [] and {} fields identically to empty strings, milestone progress and hour calculations use half-to-even rounding (round_ties_even()), Cloud Sync defaults favorite to false, Time Machine initializes library_sync metadata even when zero games changed, and non-ASCII date strings no longer panic byte-slice parsers in discovery and metadata modules.

Platform, Launcher, and Installer Fixes

  • Windows launching, pause/resume, and paths: Replaced cmd /C start with direct Win32 ShellExecuteW (with Win32_UI_WindowsAndMessaging enabled), implemented real Windows process-tree pause and resume via TH32CS_SNAPTHREAD (SuspendThread / ResumeThread), passed CREATE_NO_WINDOW to taskkill, treated ERROR_ACCESS_DENIED in OpenProcess as a live process, accepted .dll libretro cores in CORE_FILE_RE, and matched Python ntpath normalization for \\?\UNC\..., \\?\C:\..., volume prefixes, and bare \\server\share paths.
  • macOS PATH, libproc, and bundle layout: openbox-server runs apply_macos_tool_path() at startup so Homebrew and MacPorts tools are found outside terminal sessions, and crates/openbox-platform replaces raw proc_pidinfo byte offsets with typed libc::proc_bsdinfo and libc::proc_vnodepathinfo structs checked at compile time. scripts/build_macos_app.sh places plugin_runner_v2.py under Contents/Resources/openbox/app/ to match locate_runner_v2, and emulator test drain waits were raised to 10 seconds for slower shared macOS CI runners.
  • Linux, gamescope, and timeout-safe subprocesses: run_command_timeout isolates Unix child processes in their own process group (setpgid(0, 0)), drains pipes concurrently under bounded capture caps, and kills the full child tree on timeout across 7z, Flatpak, mame -listxml, hi2txt, ryzenadj, ludusavi, hoard, pgrep, and screenshot commands. open_path rejects NUL bytes, open_url allows only http:// and https://, Unix openers prefix leading - paths with ./ and reap detached opener processes, and deep-link IPC probes running servers over a dedicated no-proxy LOOPBACK_CLIENT. open_ui handles --app-window, --no-app-window, --bigbox, --width/--height/--resolution, scrubbed host environments, and xprop STEAM_GAME tagging.
  • Emulator YAML parsing and Flatpak probing: YAML parsing now handles escaped characters, quoted keys, and commas inside quoted inline-map values. version_probe inspects native --version, flatpak info --user --show-version, and flatpak remote-info --user flathub under timeouts, emulator_status preserves adapter order and declared platform lists, and bwrap sandbox probing caches its result per executable path.
  • Installers and CI smoke fixes: scripts/install.ps1 invokes app/updates.py for verification and desktop registration, CI perf-20k checks out the real release/1.19.1 baseline branch, and scripts/ui_smoke.cjs retries preset-clear clicks while async search-worker facet counts arrive.

Repository Layout Consolidation (ADR 0117)

If you build from source or maintain packaging, the repository root is now organized around build-time vs runtime concerns:

  • Moved into subdirectories: The 28 flat runtime Python modules now live under app/ (mapped to share/openbox/app/ by runtime_modules.txt), native host sources (native_host*.c/.m/.rc, openbox.ico) live under native/, install metadata (openbox.desktop, openbox.metainfo.xml, io.openbox.GameLauncher.yml) lives under packaging/, and build_appimage.sh + run_all_tests.sh join scripts/.
  • Kept at root: web_app.py, index.html, openbox.svg, openbox-release.pub, and all launcher scripts (openbox.sh, openbox-native.sh, openbox.cmd, openbox.ps1, openbox-native.ps1) stay at the root. Compiled native host binaries (native_host, native_host.exe) and installed user paths remain unchanged.

Upgrade in Under a Minute

Every release package ships the native Rust openbox-server binary directly with zero bundled Python runtime. AppImage, Windows, and macOS downloads include SHA-256 checksums and Ed25519 signatures verified by the installers and in-app updater.

Platform Download What's Inside
Linux x86_64 OpenBox-x86_64.AppImage Native Rust openbox-server, WebKitGTK host, zero bundled Python, GLIBC_2.35 floor, zsync delta updates, .sha256 / .sig / CycloneDX SBOM
Linux aarch64 OpenBox-aarch64.AppImage Native Rust openbox-server, WebKitGTK host, zero bundled Python, GLIBC_2.35 floor, zsync delta updates, .sha256 / .sig / CycloneDX SBOM
Linux Flatpak OpenBox-x86_64.flatpak Native Rust openbox-server + WebKitGTK host bundled directly; GNOME 51 runtime
Windows x86_64 OpenBox-x86_64-windows.zip Standalone openbox-server.exe + WebView2 native_host.exe (no Python needed to launch), .sha256 / .sig
Windows ARM64 OpenBox-arm64-windows.zip Standalone ARM64 openbox-server.exe + ARM64 WebView2 native_host.exe (no Python needed to launch), .sha256 / .sig / CycloneDX SBOM
macOS (Universal) OpenBox-macos.zip Universal arm64 + x86_64 OpenBox.app (WKWebView) + openbox-server; ad-hoc signed, .sha256 / .sig / CycloneDX SBOM

Linux

Use the signed AppImage installer (auto-detects x86_64 or aarch64, verifies the key pin, SHA-256 checksum, and Ed25519 signature, and installs to ~/.local/bin):

VERSION=3.1.0
curl --proto '=https' --tlsv1.2 --fail --location \
  --output install.sh \
  "https://github.com/vindeckyy/OpenBoxGL/releases/download/v${VERSION}/install.sh"
less install.sh
OPENBOX_RELEASE_TAG="v${VERSION}" bash install.sh

Or download OpenBox-x86_64.AppImage / OpenBox-aarch64.AppImage directly (chmod +x and run), or install the Flatpak bundle with flatpak install --user OpenBox-x86_64.flatpak.

macOS

Install or upgrade the universal OpenBox.app bundle with the signed installer (pass --replace on the last line when replacing an existing OpenBox.app):

VERSION=3.1.0
curl --proto '=https' --tlsv1.2 --fail --location \
  --output install-macos.sh \
  "https://github.com/vindeckyy/OpenBoxGL/releases/download/v${VERSION}/install-macos.sh"
less install-macos.sh
OPENBOX_RELEASE_TAG="v${VERSION}" bash install-macos.sh

Windows

Download and extract OpenBox-x86_64-windows.zip (or OpenBox-arm64-windows.zip):

  • Portable launch (no Python required): Run OpenBox\openbox.cmd directly from the extracted folder.
  • Full verified install (Start Menu + openbox:// links + PATH): Run powershell -ExecutionPolicy Bypass -File .\OpenBox\scripts\install.ps1 -Tag "v3.1.0" from PowerShell (verifies the Ed25519 signature using Python 3.11+ via app\updates.py and installs to %LOCALAPPDATA%\OpenBox).
  • Source checkouts: Standalone OpenBox-x86_64-windows-native-host.exe and OpenBox-arm64-windows-native-host.exe binaries (with .sha256 and .sig) are also attached to the release for placing alongside a locally built openbox-server.exe as native_host.exe.

Compatibility and Contract Notes

Note

Upgrading from OpenBox 3.0, 2.1, or 2.0? Nothing breaks. Schema 7 opens unchanged, every /api/v2 and /api/host contract stays identical, and deleting sqlite_readmodel.db still loses nothing (the search projection rebuilds automatically from library.json).

  • Coming from 1.19 (schema 6) or earlier: Opening a library does not migrate it automatically. Schema 6 waits for openbox --migrate-library (writing library.v6.backup.json first). Schema 1 through 5 requires opening once on OpenBox 2.1 before upgrading to 3.x.
  • Removed legacy surfaces (unchanged from 3.0.0): openbox --rollback-library remains removed (exits 4 without touching files; use OpenBox 2.1.0 to restore library.v6.backup.json). Plugin API v1 remains removed; plugins must declare "api_version": 2.
  • Python 3.11+ only for source runs and Python plugins: Prebuilt release packages run natively on openbox-server without Python. Running from Python source (OPENBOX_BACKEND=python) or executing .py v2 plugins requires Python 3.11 or newer. Building openbox-server from source requires Rust 1.92+ (Edition 2024; rust-toolchain.toml pins 1.99.1).
Technical contract matrix (3.0.0 vs 3.1.0)
Contract 3.0.0 3.1.0
Server backend Native Rust (openbox-server) Native Rust (openbox-server)
Formal scale 50,000 games 50,000 games
Public API /api/v2 (413 routes) /api/v2 (413 routes)
Native host channel /api/host (4 routes) /api/host (4 routes)
Library schema 7 (no migration on open) 7 (no migration on open)
Backup format Write 2, read 1 and 2 Write 2, read 1 and 2
Plugin API 2 only 2 only
Sync format 3 3
Canonical store library.json library.json

Known Limits

  • The macOS bundle is ad-hoc signed, so first launch and ad-hoc updates require Privacy & Security confirmation (System Settings > Privacy & Security > Open Anyway).
  • Linux-only features (such as Steam Game Mode / Gamescope, Flatpak management, Wine/Proton, and Faugus) remain hidden on Windows and macOS by design via the server capability contract.
  • OpenBox 1.19 cannot read a schema 7 library.
  • Windows paths longer than 260 characters depend on the system long-path opt-in.
  • Flathub submission is tracked separately.