scan_repo_root
Scan a repository root for files that shadow common developer commands and symlinks pointing outside the directory. Prevents command hijacking and hidden write-target attacks.
Instructions
Check a repo's top-level directory for files that shadow common
developer command names (git.exe, node.exe, npm.cmd, etc.),
and the whole tree for symlinks that resolve outside the directory.
Run this before opening a freshly cloned or downloaded repository in an
agentic coding tool. On Windows, several tools (Cursor, GitHub Copilot
CLI, Gemini CLI, Codex) resolve an unqualified command like git from
the current directory before PATH, so a malicious repo shipping its own
git.exe at the root runs instead of the real one, before any
workspace-trust prompt appears. Severity: critical for git (the
confirmed vector), high for shells/interpreters, medium for other common
dev tools. Only the top-level directory is checked for this, not
subdirectories.
Separately, a symlink anywhere in the tree whose resolved target lies
outside this directory is flagged too (the GhostApproval/DuneSlide
hidden-write-target pattern: an approval dialog shows a decoy path while
the symlink redirects the real write elsewhere, e.g.
~/.ssh/authorized_keys). Critical if the resolved target hits a known
sensitive path (SSH/cloud-credential directories, private key files),
high otherwise.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||