-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(security): prevent path traversal via symlinks in File.read and File.list #8727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
…ile.list Resolves a critical vulnerability where symlinks could be used to access files outside the project directory. Implemented `fs.promises.realpath` validation to ensure the actual target path is within the allowed scope. Added regression test in `packages/opencode/test/security/symlink.test.ts`.
…ile.list Resolves a critical vulnerability where symlinks could be used to access files outside the project directory. Implemented `fs.promises.realpath` validation to ensure the actual target path is within the allowed scope. Added regression test in `packages/opencode/test/security/symlink.test.ts`. Fixes anomalyco#101
fix(security): prevent path traversal via symlinks
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate/Related PRs Found:
Recommendation: Check PR #8316 most urgently, as it appears to be addressing the exact same vulnerability (symlink path traversal). Verify which PR was opened first and if one supersedes the other, or if they should be consolidated. |
…lyco#4997) - Fix Ctrl+C behavior on Windows: copies selection if present, otherwise clears/exits. - Resolve Ctrl+A conflict: move `model_provider_list` to `ctrl+alt+m`. - Fix Navigation: map `ctrl+n`/`ctrl+p` to move down/up and history next/prev. - Fix Multiline: ensure `shift+return` is mapped to newline. - Fix Word Navigation: ensure `ctrl+left`/`ctrl+right` are mapped. - Fix Word Deletion: ensure `alt+d` and `option+delete` are mapped.
fix(tui): resolve keybind conflicts and missing defaults
This PR fixes a security issue where File.read and File.list could follow symlinks outside the project directory due to lexical path checks. This allows potential path traversal. The code now resolves real paths and verifies containment before access.
Fixes:
Fixes #8313
What changed:
Updated File.read to use fs.promises.realpath() before reading.
Updated File.list to resolve paths before listing.
Added regression tests under packages/opencode/test/security/symlink.test.ts.