({ path })
| 199 | return rulePattern => matchWildcardPattern(rulePattern, pattern) |
| 200 | }, |
| 201 | async validateInput({ path }): Promise<ValidationResult> { |
| 202 | // If path is provided, validate that it exists |
| 203 | if (path) { |
| 204 | const fs = getFsImplementation() |
| 205 | const absolutePath = expandPath(path) |
| 206 | |
| 207 | // SECURITY: Skip filesystem operations for UNC paths to prevent NTLM credential leaks. |
| 208 | if (absolutePath.startsWith('\\\\') || absolutePath.startsWith('//')) { |
| 209 | return { result: true } |
| 210 | } |
| 211 | |
| 212 | try { |
| 213 | await fs.stat(absolutePath) |
| 214 | } catch (e: unknown) { |
| 215 | if (isENOENT(e)) { |
| 216 | const cwdSuggestion = await suggestPathUnderCwd(absolutePath) |
| 217 | let message = `Path does not exist: ${path}. ${FILE_NOT_FOUND_CWD_NOTE} ${getCwd()}.` |
| 218 | if (cwdSuggestion) { |
| 219 | message += ` Did you mean ${cwdSuggestion}?` |
| 220 | } |
| 221 | return { |
| 222 | result: false, |
| 223 | message, |
| 224 | errorCode: 1, |
| 225 | } |
| 226 | } |
| 227 | throw e |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | return { result: true } |
| 232 | }, |
| 233 | async checkPermissions(input, context): Promise<PermissionDecision> { |
| 234 | const appState = context.getAppState() |
| 235 | return checkReadPermissionForTool( |
nothing calls this directly
no test coverage detected