[PR #7449] fix: Harden filesystem contains checks #12406

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

Original Pull Request: https://github.com/anomalyco/opencode/pull/7449

State: open
Merged: No


What does this PR do?

  • Tightens Filesystem.contains by resolving real paths so symlinks and .. can’t escape the project root.
  • Adds path traversal tests, including a symlink escape case (skipped on Windows where symlinks may be restricted).

How did you verify your code works?

  • Ran cd packages/opencode && bun test file/path-traversal.test.ts (all tests passed).
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7449 **State:** open **Merged:** No --- ### What does this PR do? - Tightens Filesystem.contains by resolving real paths so symlinks and .. can’t escape the project root. - Adds path traversal tests, including a symlink escape case (skipped on Windows where symlinks may be restricted). ### How did you verify your code works? - Ran cd packages/opencode && bun test file/path-traversal.test.ts (all tests passed).
yindo added the pull-request label 2026-02-16 18:17:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12406