MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / validateSocketDir

Function validateSocketDir

src/daemon/socket-path.ts:68–87  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

66}
67
68function validateSocketDir(dir: string): void {
69 const linkStat = lstatSync(dir);
70 if (linkStat.isSymbolicLink()) {
71 throw new Error(`Daemon socket directory cannot be a symlink: ${dir}`);
72 }
73
74 const stat = statSync(dir);
75 if (!stat.isDirectory()) {
76 throw new Error(`Daemon socket path parent is not a directory: ${dir}`);
77 }
78
79 const uid = process.getuid?.();
80 if (uid !== undefined && stat.uid !== uid) {
81 throw new Error(`Daemon socket directory is not owned by the current user: ${dir}`);
82 }
83
84 if ((stat.mode & 0o077) !== 0) {
85 chmodSync(dir, 0o700);
86 }
87}
88
89export function ensureSocketDir(socketPath: string): void {
90 const dir = dirname(socketPath);

Callers 1

ensureSocketDirFunction · 0.85

Calls 2

isSymbolicLinkMethod · 0.80
isDirectoryMethod · 0.80

Tested by

no test coverage detected