* Check if file is within the current project's directory. * Path format: ~/.claude/projects/{sanitized-cwd}/...
(absolutePath: string)
| 282 | * Path format: ~/.claude/projects/{sanitized-cwd}/... |
| 283 | */ |
| 284 | function isProjectDirPath(absolutePath: string): boolean { |
| 285 | const projectDir = getProjectDir(getCwd()) |
| 286 | // SECURITY: Normalize to prevent path traversal bypasses via .. segments |
| 287 | const normalizedPath = normalize(absolutePath) |
| 288 | return ( |
| 289 | normalizedPath === projectDir || normalizedPath.startsWith(projectDir + sep) |
| 290 | ) |
| 291 | } |
| 292 | |
| 293 | /** |
| 294 | * Checks if the scratchpad directory feature is enabled. |
no test coverage detected