"Just open the repo and have a look" used to be a safe thing to do. Reading code does not run it. But a modern workspace is full of programs that act on a folder the moment it appears: the editor reads .vscode/, the AI coding agent reads its own settings and starts MCP servers, git runs whatever its config tells it to, and the first npm install the agent decides to run executes every dependency's install script.
That makes an unfamiliar repository, whether a fork, a sample project or a "please review this" link, a way to deliver code. This post lists the files that execute, how each one is triggered, and what to check before you or your agent touch an unfamiliar repository.
The files that run code
| File | What runs it | When |
|---|---|---|
.vscode/tasks.json with "runOn": "folderOpen" |
VS Code and its forks | When the folder opens, if automatic tasks are allowed |
.vscode/settings.json tool paths (git.path, interpreter paths, terminal profiles) |
The editor or an extension | When it launches that tool |
.claude/settings.json, .cursor/, .gemini/ agent settings |
The AI coding agent | At session start, on hooks, on tool calls |
.mcp.json, .cursor/mcp.json |
The agent host | When it starts the MCP servers listed |
package.json preinstall, install, postinstall, prepare |
npm, pnpm, Yarn | On install, often run by the agent itself |
setup.py, build.rs, Makefile |
pip, cargo, make | On install or build |
.husky/ hooks |
git, after prepare installs them |
On commit or push |
.git/hooks/*, .git/config |
git | On checkout, commit, git status and more |
Git: what clone protects you from, and what it does not
The Pro Git book is clear that "client-side hooks are not copied when you clone a repository", and the same is true of .git/config. A normal clone from a remote does not hand an attacker your hooks or config. There are three ways around that.
The repository arrives as a folder, not a clone. A zip, a tarball, a shared drive or a copied directory carries its .git/ directory with it. Its .git/config can set core.fsmonitor, which git's documentation describes as "the pathname of the 'fsmonitor' hook command". Git runs that command to find changed files, and editors and agents run git status constantly. Settings such as core.sshCommand, core.pager and diff.external run programs too. Git refuses to read the config of a repository owned by another user (the safe.directory check), but an archive you extract yourself is owned by you.
The repository contains a bare repository. A tracked directory can hold a complete bare repository. Running git inside it uses that repository's config. Git's documentation for safe.bareRepository recommends setting it to explicit if you do not use bare repositories, to protect you "from attacks that involve cloning a repository that contains a bare repository and running a Git command within that directory".
Git itself has a bug. CVE-2025-48384 (High, CVSS 8.0) let a submodule path ending in a carriage return redirect a checkout into the submodule's hooks directory, so a post-checkout hook could run on git clone --recursive. The fixed releases are 2.43.7, 2.44.4, 2.45.4, 2.46.4, 2.47.3, 2.48.2, 2.49.1 and 2.50.1. The advisory's workaround is to avoid recursively cloning submodules from untrusted repositories.
Two global settings are worth setting today:
git config --global safe.bareRepository explicit
git --version # confirm a release with the CVE-2025-48384 fixEditors: tasks that run on folder open
VS Code's tasks documentation says a task with runOn: folderOpen "will be run when the containing folder is opened". The safeguards are the task.allowAutomaticTasks setting (by default you are prompted once per workspace) and Workspace Trust: "Automatic tasks never run in an untrusted workspace, regardless of this setting."
Those safeguards only help when they are on. In September 2025 researchers reported that Cursor shipped with Workspace Trust disabled by default, so a committed tasks.json ran as soon as the folder opened. Whatever editor you use, check that security.workspace.trust.enabled is true and leave task.allowAutomaticTasks off.
AI coding agents: settings and MCP servers
Agent configuration is a newer execution surface, and the 2025 advisories show the trust decision is the weak point:
- CVE-2025-59536 (High, CVSS 4.0 score 8.7): Claude Code "could be tricked to execute code contained in a project before the user accepted the startup trust dialog". Fixed in 1.0.111.
- CVE-2025-54136 (High, CVSS 7.2): in Cursor, an attacker could modify an MCP configuration that a user had already approved and gain persistent code execution. Fixed in 1.3.
Both point to the same rule. An approval should be tied to the exact content approved, and anything an agent executes from the repository (hooks, MCP launch commands, settings that change which API endpoint it talks to) should be read by a human before the first session. A committed setting such as enableAllProjectMcpServers, or an MCP server whose launch command is bash -c with inline code, is a red flag in a repository you did not write. See auditing MCP configs for the config side.
Install scripts: the agent's first command
Ask an AI coding agent to "get this running" and its first move is usually npm install, pip install -e . or make. Each one runs code from the repository and from every dependency. Treat the install step as execution, not setup: on an untrusted repository, install with scripts off (npm install --ignore-scripts) or not at all until you have read the scripts. Our post on npm lifecycle scripts covers what breaks when you switch them off.
Before you open an unfamiliar repository
A five-minute review, done in a terminal rather than the editor:
# Editor and agent config that executes
find . -path ./node_modules -prune -o \( -name tasks.json -o -name '*.code-workspace' \
-o -name '.mcp.json' -o -name 'mcp.json' -o -path '*/.claude/settings*.json' \) -print
# Install-time scripts
grep -nE '"(preinstall|install|postinstall|prepare)"' package.json
# If the repo came as an archive or folder, not a fresh clone
git config --list --local --show-origin
ls .git/hooks | grep -v '\.sample$'Then decide where to open it. For anything you have real doubts about, use a disposable container or VM with no credentials mounted and no network, and run the AI coding agent there too. Keep editors, git and agents updated: most of the fixes above reached users through auto-update.
What Vulkro checks
vulkro inspect is built for exactly this moment: a static look at a repository you have not run yet. It surfaces install-time and hook execution surfaces (git hooks under .git/hooks/ and .husky/ that fetch, decode or evaluate code, Makefile recipes that pipe a download into a shell, setup.py and build.rs steps that shell out or download) alongside credential access, exfiltration and obfuscation shapes. It never says a repository is safe: exit 0 means only that nothing known was surfaced.
vulkro inspect ./unfamiliar-repo
vulkro scan ./unfamiliar-repoA normal scan also reads the committed agent and editor config:
| Rule | What it flags |
|---|---|
agent-cfg-folder-open-task |
A tasks.json task that runs a non-build command on folder open |
agent-cfg-auto-start-mcp |
Committed Claude Code settings that auto-start every project MCP server |
agent-cfg-api-base-url-override |
Agent settings that point the model API base URL off the vendor domain |
agent-cfg-mcp-inline-shell |
An MCP server launched as a shell or interpreter with inline code |
agent-cfg-tool-auto-approve |
Committed settings that auto-approve tool calls |
agent-cfg-tool-path-hijack |
An IDE tool path pointing into the repository or a writable directory |
install-agent-cli |
An install hook that invokes an AI agent CLI |
Vulkro does not read .git/config for core.fsmonitor or similar settings, so keep the git config --list --local check in your routine.
FAQ
Can cloning a git repository run code?
A plain git clone from a remote does not copy hooks or .git/config, so it should not run repository code. Exceptions are git bugs such as CVE-2025-48384 with recursive submodules, and repositories delivered as archives or folders, which carry their .git/ directory and its config.
What does runOn folderOpen do in tasks.json?
It tells VS Code and compatible editors to run the task when the folder is opened. With Workspace Trust on, automatic tasks never run in an untrusted workspace, and task.allowAutomaticTasks controls whether they run without a prompt in trusted ones.
How do I let an AI coding agent work on an untrusted repository?
Read its agent, MCP and install configuration first, run the agent in a disposable container or VM with no credentials and limited network, and stop it from running install scripts until you have reviewed them.
See the AI coding agents use case and the vulkro inspect docs, or start a 14-day trial. Related: prompt injection through repository content and agent permission modes.