(command: string, protectedPath: string)
| 74 | } |
| 75 | |
| 76 | function commandReferencesPath(command: string, protectedPath: string): boolean { |
| 77 | if (!protectedPath) return false; |
| 78 | let idx = command.indexOf(protectedPath); |
| 79 | while (idx >= 0) { |
| 80 | const after = command[idx + protectedPath.length]; |
| 81 | if (!after || !/[A-Za-z0-9_-]/.test(after)) return true; |
| 82 | idx = command.indexOf(protectedPath, idx + 1); |
| 83 | } |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | function isPathMatch(targetPath: string, pattern: string, cwd: string): boolean { |
| 88 | const resolvedPattern = pattern.startsWith("~") ? path.join(os.homedir(), pattern.slice(1)) : pattern; |
no outgoing calls
no test coverage detected