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(memory): keep runtime backup paths out of build tracing

Rahmanc59ba802370a
diff --git a/lib/memory-backup/history.ts b/lib/memory-backup/history.ts
index 5dff7d7f..da06393f 100644
--- a/lib/memory-backup/history.ts
+++ b/lib/memory-backup/history.ts
@@ -24,7 +24,7 @@ export async function listSnapshots(root: string, options: Options = {}): Promis
try {
const revision = stamp(await pin.directory.stat());
if (offset > 0 && revision !== options.revision) throw new Error("backup history changed; refresh the first page");
- dir = await fs.opendir(path.dirname(pin.file));
+ dir = await fs.opendir(/* turbopackIgnore: true */ path.dirname(pin.file));
const items: MemoryBackupHistory["items"] = [];
const deadline = Date.now() + 5000;
let position = 0, scannedEntries = 0, finished = false;
diff --git a/lib/memory-backup/io.ts b/lib/memory-backup/io.ts
index f56c6cee..8eb9bc7e 100644
--- a/lib/memory-backup/io.ts
+++ b/lib/memory-backup/io.ts
@@ -13,7 +13,7 @@ export async function existing(file: string) {
for (const part of file.split("/").filter(Boolean)) {
// Host-owned runtime paths are guarded below, not deployable build assets.
current = path.join(/* turbopackIgnore: true */ current, part);
- if ((await fs.lstat(current)).isSymbolicLink()) throw new Error("unsafe path");
+ if ((await fs.lstat(/* turbopackIgnore: true */ current)).isSymbolicLink()) throw new Error("unsafe path");
}
}
export async function readBytes(file: string, max: number) {
@@ -21,7 +21,7 @@ export async function readBytes(file: string, max: number) {
const pin = await pinSecurityStorePath(file);
let handle;
try {
- handle = await fs.open(pin.file, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
+ handle = await fs.open(/* turbopackIgnore: true */ pin.file, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
const before = await handle.stat();
if (!before.isFile() || before.uid !== process.getuid?.() || (before.mode & 0o022) || before.size > max) throw new Error("unsafe or oversized input");
const bytes = Buffer.alloc(before.size + 1);
@@ -43,7 +43,7 @@ export async function writeExclusive(file: string, bytes: Buffer) {
let handle;
try {
if ((await pin.directory.stat()).mode & 0o077) throw new Error("backup directory is not private");
- handle = await fs.open(pin.file, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
+ handle = await fs.open(/* turbopackIgnore: true */ pin.file, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
await handle.writeFile(bytes); await handle.sync();
} finally { await handle?.close(); await pin.directory.close(); }
}
diff --git a/lib/memory-backup/scan.ts b/lib/memory-backup/scan.ts
index fde54ad8..180d8b8c 100644
--- a/lib/memory-backup/scan.ts
+++ b/lib/memory-backup/scan.ts
@@ -21,11 +21,11 @@ export async function scanSources(sources: Source[], limits: Limits, consume?: (
if (depth > 32 || !safeRelative(name)) { report.rejected++; return; }
try {
await existing(file);
- const stat = await fs.lstat(file);
+ const stat = await fs.lstat(/* turbopackIgnore: true */ file);
if (stat.isDirectory()) {
const pin = await pinSecurityStorePath(path.join(file, ".backup-index"));
try {
- const dir = await fs.opendir(path.dirname(pin.file));
+ const dir = await fs.opendir(/* turbopackIgnore: true */ path.dirname(pin.file));
for await (const entry of dir) {
if (stopped()) break;
if (excluded.test(entry.name)) { entries++; report.excluded++; continue; }
diff --git a/lib/memory-backup/service.ts b/lib/memory-backup/service.ts
index 84805289..33a58d12 100644
--- a/lib/memory-backup/service.ts
+++ b/lib/memory-backup/service.ts
@@ -50,7 +50,7 @@ export async function createSnapshot(sources: Source[], root: string, sourceDisc
}
export async function createMemoryBackup() {
- const space = await fs.statfs(os.homedir());
+ const space = await fs.statfs(/* turbopackIgnore: true */ os.homedir());
if (space.bavail * space.bsize < LIMITS.bytes * 3 + 1024 * 1024 * 1024) throw new Error("insufficient headroom for a backup and isolated restore; source files preserved");
const inventory = await memorySources();
return createSnapshot(inventory.sources, memoryBackupRoot(), inventory.incomplete);