MCPcopy Create free account
hub / github.com/davidkingzyb/SCAST / getSafeFilePath

Function getSafeFilePath

mcp/server.js:12–17  ·  view source on GitHub ↗
(baseDir, requestPath)

Source from the content-addressed store, hash-verified

10const directoryPath = process.argv[2]||process.cwd();
11
12function getSafeFilePath(baseDir, requestPath) {
13 const normalized = path.normalize(requestPath)
14 const fullPath = path.resolve(baseDir, './'+normalized);
15 // console.log("safe path",normalized,fullPath)
16 return fullPath.startsWith(baseDir + path.sep) || fullPath === baseDir?fullPath:null;
17}
18
19const TYPE_MINE={
20 '.html':'text/html',

Callers 1

server.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected