MCPcopy Create free account
hub / github.com/acoyfellow/cloudbox / assertSafePath

Function assertSafePath

runner/server.mjs:18–24  ·  view source on GitHub ↗
(root, path)

Source from the content-addressed store, hash-verified

16}
17
18function assertSafePath(root, path) {
19 if (!path || path.includes("\0")) throw new Error("invalid artifact path");
20 const full = resolve(root, path);
21 const rel = relative(root, full);
22 if (rel.startsWith("..") || resolve(root, rel) !== full) throw new Error("artifact path escapes workspace");
23 return full;
24}
25
26const SECRET_KEYS = ["CLOUDBOX_GITLAB_TOKEN", "GITLAB_TOKEN", "NPM_TOKEN"];
27

Callers 3

handleRunFunction · 0.85
handleLiveReadFunction · 0.85
handleLiveWriteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected