MCPcopy Create free account
hub / github.com/Noumena-Network/code / isProjectDirPath

Function isProjectDirPath

src/utils/permissions/filesystem.ts:294–301  ·  view source on GitHub ↗

* Check if file is within the current project's directory. * Path format: ~/.ncode/projects/{sanitized-cwd}/...

(absolutePath: string)

Source from the content-addressed store, hash-verified

292 * Path format: ~/.ncode/projects/{sanitized-cwd}/...
293 */
294function isProjectDirPath(absolutePath: string): boolean {
295 const projectDir = getProjectDir(getCwd())
296 // SECURITY: Normalize to prevent path traversal bypasses via .. segments
297 const normalizedPath = normalize(absolutePath)
298 return (
299 normalizedPath === projectDir || normalizedPath.startsWith(projectDir + sep)
300 )
301}
302
303/**
304 * Checks if the scratchpad directory feature is enabled.

Callers 1

Calls 3

getCwdFunction · 0.85
getProjectDirFunction · 0.50
normalizeFunction · 0.50

Tested by

no test coverage detected