(parentDir: string, targetPath: string)
| 27 | } |
| 28 | |
| 29 | export function isWithinDirectory(parentDir: string, targetPath: string): boolean { |
| 30 | const relativePath = path.relative(path.resolve(parentDir), path.resolve(targetPath)); |
| 31 | return relativePath !== ".." && !relativePath.startsWith(`..${path.sep}`) && !path.isAbsolute(relativePath); |
| 32 | } |
no outgoing calls
no test coverage detected