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(fs): cap the complete enumeration response

rahmanef208e25435814
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 70b84de9..4f48ea61 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh
**Fixed**
+- `fs` cap the complete enumeration response
- `security` revalidate durable authority and bound follow-up scan paths
- `heartbeat` preserve relative env paths in cron
- `ux` reuse existing loading and glass styles within the shell budget
diff --git a/lib/host/fs-enumeration.test.ts b/lib/host/fs-enumeration.test.ts
index edcd50a7..cdac24f6 100644
--- a/lib/host/fs-enumeration.test.ts
+++ b/lib/host/fs-enumeration.test.ts
@@ -19,3 +19,9 @@ it("bounds oversized listings, sparse searches and concurrent work, releasing ad
await expect(listDir(root)).resolves.toMatchObject({ entries: [{ name: "large" }] });
await expect(listDir(root, true, AbortSignal.abort())).rejects.toMatchObject({ status: 408 });
}, 15_000);
+
+it("bounds the complete listing response including configured-root metadata", async () => {
+ process.env.OS_FS_READ_ROOTS = [root, ...Array(12_000).fill("/")].join(path.delimiter);
+ try { await expect(listDir(root)).rejects.toMatchObject({ status: 413 }); }
+ finally { process.env.OS_FS_READ_ROOTS = root; }
+});
diff --git a/lib/host/fs-enumeration.ts b/lib/host/fs-enumeration.ts
index 6fe347c7..a126b894 100644
--- a/lib/host/fs-enumeration.ts
+++ b/lib/host/fs-enumeration.ts
@@ -19,7 +19,10 @@ async function bounded<T>(signal: AbortSignal | undefined, run: (charge: (bytes?
throw new HostError("Filesystem enumeration budget exceeded; choose a narrower directory", 413);
};
let timer: ReturnType<typeof setTimeout> | undefined;
- const work = run(charge).finally(() => { active--; });
+ const work = run(charge).then((value) => {
+ if (Buffer.byteLength(JSON.stringify(value)) > MAX_BYTES) throw new HostError("Filesystem response budget exceeded", 413);
+ return value;
+ }).finally(() => { active--; });
try {
return await Promise.race([work, new Promise<never>((_, reject) => {
timer = setTimeout(() => reject(new HostError("Filesystem enumeration deadline exceeded", 408)), TIME_MS);