MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / readPrivateFile

Function readPrivateFile

packages/server/src/services/auth/privateFiles.ts:55–65  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

53}
54
55export async function readPrivateFile(filePath: string): Promise<Buffer> {
56 const info = await stat(filePath);
57 // Windows does not have Unix-style permission bits; libuv synthesises the
58 // mode from the read-only attribute, so a private writable file is reported
59 // as 0o666 and a read-only one as 0o444. The ACL-based security model is
60 // different, so this check only makes sense on POSIX systems.
61 if (process.platform !== 'win32' && (info.mode & 0o077) !== 0) {
62 throw new PrivateFileTooPermissiveError(filePath, info.mode & 0o777);
63 }
64 return readFile(filePath);
65}

Callers 2

readServerTokenFunction · 0.90

Calls 2

statFunction · 0.50
readFileFunction · 0.50

Tested by

no test coverage detected