Commit 88ecfdd
committed
fix(security): O_NOFOLLOW for searchFilesTool.searchContent and glob tool binary-skip
The searchFilesTool.searchContent() and the glob tool's binary-skip
path opened files with plain os.Open() — no O_NOFOLLOW. An attacker
with write access under the search root could exploit the TOCTOU
window between the filepath.Walk check and the actual open.
Both now use os.OpenFile(path, os.O_RDONLY|syscall.O_NOFOLLOW, 0),
consistent with readFileTool, batchReadTool, and all other file tools.
Fixes H1 from security audit.1 parent 3d2c58f commit 88ecfdd
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
| 393 | + | |
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1098 | 1098 | | |
1099 | 1099 | | |
1100 | 1100 | | |
1101 | | - | |
| 1101 | + | |
1102 | 1102 | | |
1103 | 1103 | | |
1104 | 1104 | | |
| |||
0 commit comments