fix(security): Symlink TOCTOU race condition#482
fix(security): Symlink TOCTOU race condition#482GoCeylan wants to merge 1 commit intosipeed:mainfrom
Conversation
nikolasdehor
left a comment
There was a problem hiding this comment.
Textbook TOCTOU fix. Returning the resolved path ensures callers operate on the validated target, closing the race window between check and use. LGTM.
lxowalle
left a comment
There was a problem hiding this comment.
The changes here do not seem to completely prevent this type of issue. If the workspace has already been redirected to a dangerous path before the program starts, the problem will still inevitably occur.
|
This fixes the symlink TOCTOU race, which is also addressed in #331 (broader security hardening) and #464 (workspace sandbox TOCTOU). #331 is the most comprehensive — it covers shell escape bypass, SSRF, and working_dir validation in addition to the TOCTOU fix. Suggesting this be closed in favor of #331. |
|
Good shout @nikolasdehor & @lxowalle . |
@Leeaandrob
validatePath() resolved symlinks for validation but returned the original unresolved path. An attacker could retarget the symlink between check and use. Now returns the resolved path directly.
🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
Security audit finding, no existing issue.
📚 Technical Context (Skip for Docs)
🧪 Test Environment
📸 Evidence (Optional)
One-line change: absPath = resolved after symlink validation passes.
☑️ Checklist