* Check if file is within the current project's directory. * Path format: ~/.ncode/projects/{sanitized-cwd}/...
(absolutePath: string)
| 292 | * Path format: ~/.ncode/projects/{sanitized-cwd}/... |
| 293 | */ |
| 294 | function 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. |
no test coverage detected