MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / isWithinDirectory

Function isWithinDirectory

src/runtime/files/metadata.ts:29–32  ·  view source on GitHub ↗
(parentDir: string, targetPath: string)

Source from the content-addressed store, hash-verified

27}
28
29export function isWithinDirectory(parentDir: string, targetPath: string): boolean {
30 const relativePath = path.relative(path.resolve(parentDir), path.resolve(targetPath));
31 return relativePath !== ".." && !relativePath.startsWith(`..${path.sep}`) && !path.isAbsolute(relativePath);
32}

Callers 1

resolveDownloadFilePathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected