mirror of
https://github.com/morluto/rea.git
synced 2026-11-09 08:17:02 +00:00
fix(macho): preserve POSIX app executable names (#7888)
This commit is contained in:
1 parent
f6380282fb
commit
583a316e11
3 files changed
+94
-2
No files matched your search
@@ -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("\\"));
|
||||
Reference in new issue
Block a user