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.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(install): guard earliest bootstrap prefix
Rahmana78d05904982
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 4c79985e..acfa4f16 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `install` guard earliest bootstrap prefix- `install` make bootstrap handoff truncation-safe- `install` make one-line bootstrap atomic- `install` bind readiness to runtime instancediff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 6f86c1c0..15566172 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -61,9 +61,11 @@ not exist.The public `scripts/install.sh` is now an intentionally small bootstrap. It downloads the complete`scripts/install-core.sh` to an owner-private temporary file first, retries the transfer, requiresa minimum payload size and exact EOF marker, verifies the committed SHA-256, runs `bash -n`, and-only then hands off with a final `exec`. There is deliberately no earlier "done" assignment: any-normal bootstrap exit before that `exec` is converted to a non-zero truncation failure, including-a syntactically complete network prefix. The core carries phase-only error+only then hands off with a final `exec`. The fail-closed `EXIT` trap is the **first executable+statement after the shebang**, before comments or variable setup, and there is deliberately no+earlier "done" assignment. Every later syntactically complete network prefix therefore becomes a+non-zero truncation failure instead of a false success; a regression includes the exact early-prefix+shape (`head -n 16`) that independent review used to reproduce the remaining gap. The core carries phase-only errorreporting (no raw command/secret echo). A second clean-image reproduction found that `bin/mso` alsorequires `jq`: Node and Bun alone were not enough, and the old installer never installed that CLIruntime dependency. The core now verifies/installs `curl`, `jq` and the required coreutils beforediff --git a/lib/install-contract.test.ts b/lib/install-contract.test.tsindex 435c5316..74ff4020 100644--- a/lib/install-contract.test.ts+++ b/lib/install-contract.test.ts@@ -32,6 +32,26 @@ describe("one-line installer contract", () => {expect(core.toString("utf8").trimEnd().endsWith("# MSO_INSTALLER_CORE_EOF")).toBe(true);});+ it("installs the fail-closed trap as the first executable bootstrap statement", () => {+ const bootstrap = fs.readFileSync(BOOTSTRAP, "utf8");+ const lines = bootstrap.split(/\r?\n/);+ expect(lines[0]).toBe("#!/usr/bin/env bash");+ expect(lines[1]).toMatch(/^trap .* EXIT$/);++ // Regression for the real review reproducer: once the shebang has been read,+ // every later syntactically complete prefix is already guarded.+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "mso-bootstrap-early-prefix-"));+ try {+ const prefix = path.join(dir, "install.sh");+ fs.writeFileSync(prefix, `${lines.slice(0, 16).join("\n")}\n`);+ const result = spawnSync("bash", [prefix], { encoding: "utf8" });+ expect(result.status).toBe(97);+ expect(result.stderr).toContain("before verified-core handoff");+ } finally {+ fs.rmSync(dir, { recursive: true, force: true });+ }+ });+it("rejects a syntactically complete bootstrap prefix before the final exec handoff", () => {const bootstrap = fs.readFileSync(BOOTSTRAP, "utf8");const cutoff = bootstrap.indexOf('exec bash /proc/self/fd/3 "$@"');diff --git a/scripts/install.sh b/scripts/install.shindex 58c31b99..19b252a8 100755--- a/scripts/install.sh+++ b/scripts/install.sh@@ -1,4 +1,5 @@#!/usr/bin/env bash+trap 'rc=$?; trap - EXIT; [ -z "${TMP_INSTALLER:-}" ] || rm -f "$TMP_INSTALLER"; if [ "$rc" -eq 0 ]; then printf "mso installer bootstrap ended before verified-core handoff; retry the download.\n" >&2; rc=97; fi; exit "$rc"' EXIT# MSO one-line installer bootstrap.## curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh | bash@@ -15,22 +16,6 @@ CORE_SHA256="913350997e568a279c6582e752d38151f20798cb1f1e471b557aba06b71821ad"CORE_EOF='# MSO_INSTALLER_CORE_EOF'TMP_INSTALLER=''-bootstrap_exit() {- rc=$?- trap - EXIT- [ -z "$TMP_INSTALLER" ] || rm -f "$TMP_INSTALLER"- # The bootstrap has exactly one success path: the final `exec` replaces this- # process with the verified core. Therefore ANY normal return from this streamed- # bootstrap means the response ended before handoff, even if the last complete- # prefix happened to have status 0.- if [ "$rc" -eq 0 ]; then- printf 'mso installer bootstrap ended before verified-core handoff; retry the download.\n' >&2- rc=97- fi- exit "$rc"-}-trap bootstrap_exit EXIT-fail() { printf 'mso installer bootstrap: %s\n' "$*" >&2; exit 1; }command -v curl >/dev/null 2>&1 || fail 'curl is required.'command -v sha256sum >/dev/null 2>&1 || fail 'sha256sum is required to verify the installer payload.'