(root: string, candidate: string, message: string)
| 182 | } |
| 183 | |
| 184 | function assertContained(root: string, candidate: string, message: string): void { |
| 185 | const localPath = relative(root, candidate); |
| 186 | if (localPath === '' || (localPath !== '..' && !localPath.startsWith(`..${sep}`) && !isAbsolute(localPath))) return; |
| 187 | throw new Error(message); |
| 188 | } |
| 189 | |
| 190 | async function canonicalDirectory(path: string, label: string): Promise<string> { |
| 191 | const canonicalPath = await realpath(path); |
no outgoing calls
no test coverage detected