MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / isSafeRequestPath

Function isSafeRequestPath

src/ui-server/security.ts:208–212  ·  view source on GitHub ↗
(rawPath: string)

Source from the content-addressed store, hash-verified

206 * segments away — that folding is what would hide the attempt.
207 */
208export function isSafeRequestPath(rawPath: string): boolean {
209 const decoded = decodePath(rawPath);
210 if (decoded === null) return false;
211 return !decoded.split('/').includes('..');
212}
213
214/**
215 * Resolve a request path to a file inside the static asset root.

Callers 2

handleRequestFunction · 0.90
ui-server.test.tsFile · 0.90

Calls 1

decodePathFunction · 0.85

Tested by

no test coverage detected