Commit 8021546
fix: return resolved path from validatePath to prevent symlink write bypass
Previously, validatePath() resolved symlinks for the allowlist check but
returned the original (unresolved) path. This meant callers like writeFile()
and createDirectory() would still operate on the symlink path, following it
to the restricted target. Now validatePath() consistently returns the
resolved (canonical) path so all subsequent file operations use the real
target path, closing the symlink write bypass vector.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 5f82367 commit 8021546
1 file changed
Lines changed: 12 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
249 | 254 | | |
250 | 255 | | |
251 | 256 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 257 | + | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
262 | | - | |
| 261 | + | |
| 262 | + | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | | - | |
267 | | - | |
| 266 | + | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| |||
0 commit comments