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
test(gateway): harden hosted security fixtures
Rahman975ff8a8c2b5
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 85a02c3d..ee69255b 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -31,6 +31,10 @@ this is the *what*, and it is what Settings → About shows as “What's new”.- `security` harden GitHub quality controls- `security` canonicalize writable path containment+**Tests**++- `gateway` harden hosted security fixtures+**Docs**- `security` disclose scorecard posture gapsdiff --git a/scripts/mso-gateway-lifecycle.test.ts b/scripts/mso-gateway-lifecycle.test.tsindex 177aa64a..c93153a8 100644--- a/scripts/mso-gateway-lifecycle.test.ts+++ b/scripts/mso-gateway-lifecycle.test.ts@@ -43,6 +43,14 @@ function identity(pid: number) {cmdHash: createHash("sha256").update(fs.readFileSync(`/proc/${pid}/cmdline`)).digest("hex") };}function writeState(dir: string, value: unknown) { fs.writeFileSync(path.join(dir, "state.json"), JSON.stringify(value), { mode: 0o600 }); }+function readRegularSnapshot(file: string) {+ const fd = fs.openSync(file, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);+ try {+ const stat = fs.fstatSync(fd);+ if (!stat.isFile()) throw new Error(`expected regular file: ${file}`);+ return { mode: stat.mode & 0o777, text: fs.readFileSync(fd, "utf8") };+ } finally { fs.closeSync(fd); }+}function alive(pid: number) { try { process.kill(pid, 0); return true; } catch { return false; } }function asyncStart(env: NodeJS.ProcessEnv) {return new Promise<{ code: number | null; stdout: string; stderr: string }>((resolve) => {@@ -152,7 +160,8 @@ esacit("persists recovery intent before stopping and reconciles stale ownership after a state-write failure", async () => {const f = fixture();- const pid = Number(execFileSync("bash", ["-c", `nohup ${JSON.stringify(process.execPath)} -e \"process.title='next-server (fixture)';process.on('SIGTERM',()=>process.exit(0));setInterval(()=>{},1000)\" >/dev/null 2>&1 & echo $!`], { encoding: "utf8" }).trim());+ const runtime = spawn(process.execPath, ["-e", "process.title='next-server (fixture)';process.on('SIGTERM',()=>process.exit(0));setInterval(()=>{},1000)"], { stdio: "ignore" });+ const pid = runtime.pid!;pids.add(pid);await new Promise((r) => setTimeout(r, 120));const rid = { ...identity(pid), cmdHash: null, instanceId: "fixture" };@@ -172,8 +181,9 @@ exec /bin/mv "$@"expect(first.stderr).toContain("recovery marker preserved");for (let i = 0; i < 80 && alive(pid); i++) await new Promise((r) => setTimeout(r, 20));expect(alive(pid)).toBe(false);- expect(fs.statSync(markerPath).mode & 0o777).toBe(0o600);- expect(fs.readFileSync(markerPath, "utf8").trim()).toBe("1");+ const recoveryMarker = readRegularSnapshot(markerPath);+ expect(recoveryMarker.mode).toBe(0o600);+ expect(recoveryMarker.text.trim()).toBe("1");expect(JSON.parse(fs.readFileSync(path.join(f.state, "state.json"), "utf8")).runtimeOwned).toBe(true);fs.unlinkSync(mv);@@ -183,7 +193,7 @@ exec /bin/mv "$@"const reconciled = JSON.parse(fs.readFileSync(path.join(f.state, "state.json"), "utf8"));expect(reconciled.runtimeOwned).toBe(false);expect(reconciled.runtimeIdentity).toBeNull();- expect(fs.readFileSync(markerPath, "utf8").trim()).toBe("1");+ expect(readRegularSnapshot(markerPath).text.trim()).toBe("1");});it("serializes concurrent starts so only one public tunnel is spawned", async () => {diff --git a/scripts/mso-update.test.ts b/scripts/mso-update.test.tsindex 9cb555f8..2ccfd1fa 100644--- a/scripts/mso-update.test.ts+++ b/scripts/mso-update.test.ts@@ -131,7 +131,7 @@ describe("mso update without a running web API", () => {const f = fixture();execFileSync(SCRIPT, [], { env: f.env, encoding: "utf8" });const repoB = path.join(f.root, "repo-b");- execFileSync("git", ["clone", "-q", f.remote, repoB]);+ execFileSync("git", ["clone", "-q", "--branch", "main", f.remote, repoB]);const envB = { ...f.env, MSO_UPDATE_ROOT: repoB };const before = fs.readFileSync(f.capture, "utf8");const out = execFileSync(SCRIPT, [], { env: envB, encoding: "utf8" });