Path traversal vulnerability via symlinks and cross-drive paths #5490

Open
opened 2026-02-16 17:53:21 -05:00 by yindo · 0 comments
Owner

Originally created by @mluckydream on GitHub (Jan 13, 2026).

Originally assigned to: @thdxr on GitHub.

Description

Problem

The Filesystem.contains() function uses lexical path checking only, which allows:

  • Symlink escape attacks
  • Cross-drive path bypass on Windows

See TODO comments in src/file/index.ts:280-281 and 340-341

Solution

Use realpathSync() to resolve symlinks and validate drive letters on Windows.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @mluckydream on GitHub (Jan 13, 2026). Originally assigned to: @thdxr on GitHub. ### Description ## Problem The `Filesystem.contains()` function uses lexical path checking only, which allows: - Symlink escape attacks - Cross-drive path bypass on Windows See TODO comments in `src/file/index.ts:280-281` and `340-341` ## Solution Use `realpathSync()` to resolve symlinks and validate drive letters on Windows. ### Plugins _No response_ ### OpenCode version _No response_ ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 17:53:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#5490