MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / validateWorkTreeId

Function validateWorkTreeId

projects/electron/src/modules/code/git.ts:370–377  ·  view source on GitHub ↗

* Validate worktree ID (prevent path traversal)

(id: string)

Source from the content-addressed store, hash-verified

368 * Validate worktree ID (prevent path traversal)
369 */
370function 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

Callers 7

handleWorkTreeDiffPatchFunction · 0.85
handleGetMergeBaseFunction · 0.85
handleListFilesFunction · 0.85
handleDeleteWorkTreeFunction · 0.85
handleCommitWorkTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected