MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / resolveChildPath

Function resolveChildPath

packages/core/src/tools/scaffold.ts:128–135  ·  view source on GitHub ↗
(root: string, relPath: string)

Source from the content-addressed store, hash-verified

126}
127
128function resolveChildPath(root: string, relPath: string): string {
129 const absRoot = path.resolve(root);
130 const absPath = path.resolve(absRoot, relPath);
131 if (!isWithinRoot(absRoot, absPath)) {
132 throw new Error('path outside root');
133 }
134 return absPath;
135}
136
137async function resolveSafeChildPath(root: string, relPath: string): Promise<string> {
138 const absRoot = path.resolve(root);

Callers 1

resolveSafeChildPathFunction · 0.85

Calls 1

isWithinRootFunction · 0.70

Tested by

no test coverage detected