(workspaceDir: string, abs: string, relPath: string)
| 93 | } |
| 94 | |
| 95 | async function assertRealPathInsideWorkspace(workspaceDir: string, abs: string, relPath: string): Promise<void> { |
| 96 | const [workspaceReal, targetReal] = await Promise.all([ |
| 97 | realpath(workspaceDir), |
| 98 | realpath(abs), |
| 99 | ]) |
| 100 | if (targetReal !== workspaceReal && !targetReal.startsWith(workspaceReal + sep)) { |
| 101 | throw new WorkspacePathTraversal(relPath) |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | async function listWorkspaceDir(workspaceDir: string, relPath: string): Promise<{ path: string; entries: FileEntry[] }> { |
| 106 | const cleanRel = normalize(relPath || '.') |
no outgoing calls
no test coverage detected