Skip to content

fix(security): skip symlinks in discovery to prevent exfiltration#3

Open
cedric-appdirect wants to merge 1 commit into
jgordijn:mainfrom
cedric-appdirect:security/symlink-prevention
Open

fix(security): skip symlinks in discovery to prevent exfiltration#3
cedric-appdirect wants to merge 1 commit into
jgordijn:mainfrom
cedric-appdirect:security/symlink-prevention

Conversation

@cedric-appdirect

Copy link
Copy Markdown

Add three layers of symlink protection to discovery functions:

  1. entry.isFile() guard on leaf-file checks in discoverAgents, discoverCommands, and discoverPlugins — prevents reading symlinks disguised as .md/.ts/.js files.

  2. !entry.isSymbolicLink() guard on directory traversal in all four discovery functions — prevents following symlink-to-directory into arbitrary filesystem paths.

  3. fs.lstatSync() for SKILL.md existence check in discoverSkills — prevents reading a symlinked SKILL.md that points outside the repo. Assisted-by: OpenCode with claude-opus-4-7

Add three layers of symlink protection to discovery functions:

1. entry.isFile() guard on leaf-file checks in discoverAgents,
   discoverCommands, and discoverPlugins — prevents reading symlinks
   disguised as .md/.ts/.js files.

2. !entry.isSymbolicLink() guard on directory traversal in all four
   discovery functions — prevents following symlink-to-directory into
   arbitrary filesystem paths.

3. fs.lstatSync() for SKILL.md existence check in discoverSkills —
   prevents reading a symlinked SKILL.md that points outside the repo.

Assisted-by: OpenCode with claude-opus-4-7
@cedric-appdirect cedric-appdirect force-pushed the security/symlink-prevention branch from 8899215 to 1ee7c2e Compare April 21, 2026 22:48
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.

1 participant