* Validate worktree ID (prevent path traversal)
(id: string)
| 368 | * Validate worktree ID (prevent path traversal) |
| 369 | */ |
| 370 | function validateWorkTreeId(id: string): void { |
| 371 | if (!id || typeof id !== "string") { |
| 372 | throw new Error("workTreeId must be a non-empty string") |
| 373 | } |
| 374 | if (id.includes("..") || id.includes("/") || id.includes("\\")) { |
| 375 | throw new Error("workTreeId cannot contain path traversal characters") |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * Resolve git repository root and relative path from any directory within a repo |
no outgoing calls
no test coverage detected