Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(forge): make sandbox bootstrap portable on hosted Linux

Rahmana2266136ac8d
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 779111ba..33986061 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -12,6 +12,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Fixed**
+- `forge` make sandbox bootstrap portable on hosted Linux
- `doctor` respect no-systemd and remote runtimes
- `hosted` restore updates and Hermes runtime
- `update` recover no-systemd container installs
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 3943fe0d..44aa0141 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,7 @@
+## 2026-09-17 — Portable executable Forge sandbox bootstrap
+
+A hosted Debian audit found two bootstrap assumptions that prevented the real, network-disabled Forge sandbox from starting: non-GNU awk omitted the ELF interpreter from `ldd`, and the imported `mktemp` root retained mode 0700. The bootstrap now uses POSIX whitespace matching and sets only the root traversal mode to 0755, without granting write access or changing the container isolation flags. Regression fixtures cover glibc/musl loader rows and the root mode; the real Docker fixture tests verify source read-only mounts, disabled networking and source-change refusal. The image is still built exclusively from the already-trusted local Node binary and shared libraries, with no version downgrade or registry download.
+
## 2026-09-17 — Doctor respects no-systemd and remote runtime boundaries
A live hosted/container audit reproduced a false `mso.service not active` failure while the loopback runtime, public HTTPS and authenticated CLI were healthy. Doctor now probes actual systemd manager availability before diagnosing its service and never inspects this machine's units for a remote `--base`. No-systemd hosts continue through the normal health/auth checks without suppressing real failures: health must be JSON identifying a healthy MSO service, and local probes bypass outbound proxy variables. `--fix` never creates a tunnel, adopts an external supervisor, or claims boot persistence. Added regressions for unavailable managers, inactive real services, remote bases, failed health and unrelated HTTP 200 responses; documented the hosted startup and verified-public-origin boundaries. This changes diagnosis only; no runtime, bind, provider, Node version or existing hosted Hermes/update behavior is replaced.
diff --git a/scripts/provision-forge-sandbox.sh b/scripts/provision-forge-sandbox.sh
index 743c0377..2de718ac 100755
--- a/scripts/provision-forge-sandbox.sh
+++ b/scripts/provision-forge-sandbox.sh
@@ -10,6 +10,8 @@ command -v docker >/dev/null || { echo "Tool Forge: docker is required for execu
docker info >/dev/null 2>&1 || { echo "Tool Forge: docker daemon is unavailable to this user" >&2; exit 1; }
NODE_BIN="$(readlink -f "$NODE_BIN")"
ROOT="$(mktemp -d "${TMPDIR:-/tmp}/mso-forge-rootfs.XXXXXX")"
+# mktemp uses 0700; the imported root must be traversable by sandbox UIDs.
+chmod 0755 "$ROOT"
cleanup() {
find "$ROOT" -type f -delete 2>/dev/null || true
find "$ROOT" -depth -type d -empty -delete 2>/dev/null || true
@@ -17,7 +19,7 @@ cleanup() {
trap cleanup EXIT HUP INT TERM
install -Dm755 "$NODE_BIN" "$ROOT/usr/bin/node"
# ldd output has two useful forms: `name => /abs/path (...)` and `/abs/loader (...)`.
-mapfile -t LIBS < <(ldd "$NODE_BIN" | awk '/=> \/[^ ]+/ {print $3} /^\s*\/[^ ]+/ {print $1}' | sort -u)
+mapfile -t LIBS < <(ldd "$NODE_BIN" | awk '/=> \/[^ ]+/ {print $3} /^[[:space:]]*\/[^ ]+/ {print $1}' | sort -u)
[ "${#LIBS[@]}" -gt 0 ] || { echo "Tool Forge: could not resolve Node shared libraries" >&2; exit 1; }
for lib in "${LIBS[@]}"; do
[ -f "$lib" ] || { echo "Tool Forge: missing shared library $lib" >&2; exit 1; }
diff --git a/scripts/provision-forge-sandbox.test.ts b/scripts/provision-forge-sandbox.test.ts
new file mode 100644
index 00000000..402c9494
--- /dev/null
+++ b/scripts/provision-forge-sandbox.test.ts
@@ -0,0 +1,32 @@
+import { spawnSync } from "node:child_process";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { describe, expect, it } from "vitest";
+
+const source = readFileSync(path.join(__dirname, "provision-forge-sandbox.sh"), "utf8");
+
+describe("portable Forge sandbox library discovery", () => {
+ it("makes the imported root traversable without granting write access", () => {
+ expect(source).toContain('chmod 0755 "$ROOT"');
+ });
+
+ it("uses POSIX whitespace syntax rather than a GNU-only awk extension", () => {
+ expect(source).toContain("[[:space:]]");
+ expect(source).not.toContain("\\s*");
+ });
+
+ it("includes the ELF interpreter from tab/space-prefixed ldd output", () => {
+ const program = source.match(/\| awk '([^']+)'/)?.[1];
+ expect(program).toBeTruthy();
+ const result = spawnSync("awk", [program!], {
+ encoding: "utf8",
+ input: "\tlinux-vdso.so.1 (0x1234)\n\tlibc.so.6 => /lib/libc.so.6 (0x1234)\n\t/lib64/ld-linux-x86-64.so.2 (0x1234)\n /lib/ld-musl-aarch64.so.1 (0x1234)\n",
+ });
+ expect(result.status).toBe(0);
+ expect(result.stdout.trim().split("\n")).toEqual([
+ "/lib/libc.so.6",
+ "/lib64/ld-linux-x86-64.so.2",
+ "/lib/ld-musl-aarch64.so.1",
+ ]);
+ });
+});