MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / assertRealPathInsideDirectory

Function assertRealPathInsideDirectory

src/services/rules/rules.ts:371–375  ·  view source on GitHub ↗
(filePath: string, directoryPath: string)

Source from the content-addressed store, hash-verified

369}
370
371async function assertRealPathInsideDirectory(filePath: string, directoryPath: string): Promise<void> {
372 if (!(await isRealPathInsideDirectory(filePath, directoryPath))) {
373 throw new Error("Rule path must stay inside the rules directory")
374 }
375}
376
377async function isRealPathInsideDirectory(filePath: string, directoryPath: string): Promise<boolean> {
378 const [realFilePath, realDirectoryPath] = await Promise.all([fs.realpath(filePath), fs.realpath(directoryPath)])

Callers 1

resolveRuleFileFunction · 0.85

Calls 1

Tested by

no test coverage detected