anomalyco / anomalyco/opencode

Symlink inside the project bypasses external_directory, and the permission prompt shows the wrong path

Open
#40,160 2 comments 1 reaction 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 2, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

The project containment check is pure path arithmetic and does not resolve symlinks, but the file read or write that follows does. A symlink inside the project pointing somewhere outside it passes the check, so external_directory never fires and the operation lands outside the project.

The prompt you do get is also misleading rather than just absent. read and edit show the path relative to the worktree, so you see the in-project link path while a different file is being opened.

Windows does not have this, because it already resolves the path at this point. It is POSIX only.

Plugins

None

OpenCode version

1.18.11

Steps to reproduce
  1. mkdir -p /tmp/outside && echo secret > /tmp/outside/notes.txt
  2. In your project root: ln -s /tmp/outside vendor
  3. Ask the agent to read vendor/notes.txt
  4. No external_directory prompt appears, and the file contents are returned.
  5. The read prompt shows vendor/notes.txt, not /tmp/outside/notes.txt
  6. Same with a write. Ask it to write to vendor/new.txt and the file appears in /tmp/outside/
Screenshot and/or share link

No response

Operating System

Ubuntu 26.04

Terminal

GNOME Terminal (Ubuntu default)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.