Skip to content

Conversation

@Ashwinhegde19
Copy link

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.

google-labs-jules bot and others added 3 commits January 15, 2026 18:49
…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
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate/Related PRs Found:

  1. PR fix: prevent path traversal via symlinks and cross-drive paths #8316: fix: prevent path traversal via symlinks and cross-drive paths

  2. PR fix: address external_directory gaps and improve symlink checks #7515: fix: address external_directory gaps and improve symlink checks

  3. PR fix: prevent symlink escape in Filesystem.contains #6403: fix: prevent symlink escape in Filesystem.contains

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Path traversal vulnerability via symlinks and cross-drive paths

1 participant