fix(security): prevent path traversal via symlinks in File.read and File.list#8727
Closed
Ashwinhegde19 wants to merge 0 commit intoanomalyco:devfrom
Closed
fix(security): prevent path traversal via symlinks in File.read and File.list#8727Ashwinhegde19 wants to merge 0 commit intoanomalyco:devfrom
Ashwinhegde19 wants to merge 0 commit intoanomalyco:devfrom
Conversation
Contributor
|
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. |
This was referenced Jan 24, 2026
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
This was referenced Jan 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.