MCPcopy Index your code
hub / github.com/cobusgreyling/loop-engineering / assertSafeSegment

Function assertSafeSegment

tools/mcp-server/src/resolver.ts:15–19  ·  view source on GitHub ↗
(name: string, label: string)

Source from the content-addressed store, hash-verified

13
14/** Reject path segments that could escape the project root. */
15export function assertSafeSegment(name: string, label: string): void {
16 if (!name || name.includes('\0') || name.includes('..') || name.includes('/') || name.includes('\\')) {
17 throw new Error(`Invalid ${label}: ${name}`);
18 }
19}
20
21async function allowedPatternIds(root: string): Promise<Set<string>> {
22 const registry = await loadRegistry(root);

Callers 2

loadPatternDocFunction · 0.85
loadStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected