fix(macho): preserve POSIX app executable names (#7888)

This commit is contained in:
morluto authored and GitHub committed 2026-10-29 05:08:17 +08:00
1 parent f6380282fb
commit 583a316e11
3 files changed
+94 -2

No files matched your search

+4 -2
View File
@@ -1,5 +1,5 @@
import { lstat, opendir, readFile, realpath, stat } from "node:fs/promises";
import { join } from "node:path";
import { join, sep } from "node:path";
import { z } from "zod";
@@ -357,9 +357,11 @@ const parseBinaryPlistExecutable = (plist: Buffer): string => {
return executableName(decodeBinaryPlistValue(plist, plan));
};
/** Names are one local path component; backslash is literal on POSIX hosts. */
const isSafeExecutableName = (name: string): boolean =>
name.length > 0 &&
name !== "." &&
name !== ".." &&
!name.includes("\0") &&
!/[/\\]/u.test(name);
!name.includes("/") &&
(sep !== "\\" || !name.includes("\\"));