Playbooks · Coding tasks
Audit a repository's git config before any agent opens it
Written October 31, 2026
Before an agent opens a folder that arrived as files, read the repository's own git config for settings that name a program git will run. A plain clone does not carry that config, but a folder handed over as files does — and the agent's first background git call can run the program before any trust prompt appears.
What the risk is
Manifold Security disclosed this pattern in early September 2026 under the name GitSpawn: eight findings across seven command-line coding agents. Coding agents run git status or git diff in the background to learn the branch and what changed. Both commands refresh git's index first, and the index refresh runs the helper program named by the repository's own core.fsmonitor setting, read from the repository's .git/config file. The command runs as your user, on your machine, outside the agent's sandbox, and never passes an approval prompt. In Manifold's testing, the payload fired before the workspace-trust prompt was accepted in Claude Code and Hermes Agent, before authentication in Qwen Code, and on the first keystroke in Grok Build. The rule Manifold states for the defence is short: any setting that names a program can run it.
Running git status yourself in that folder before the audit has the same effect as the agent running it. Read the config first, and run nothing that touches the working tree until you have.
Which folders this covers
This audit is for a repository that arrives as files with its .git directory already inside it: a shared zip file, a shared drive folder, a sync folder, a USB stick, or a handover from another developer. Cloning a hostile URL does nothing, and neither does fetch or pull — git's transfer protocol does not carry the source repository's local config. If you cloned the repository yourself from its remote, this audit does not apply. If the folder arrived any other way, it does.
Steps
- Do not open the folder with an agent yet. Do not run
git statusorgit diffin it first. Those are the calls that refresh the index. - Read the config file as text. Open
.git/configin a plain text editor, or print it withcat. You are looking for any line whose value names a program or a script. The two keys named below matter most, but the rule is the value, not the key: if a setting names a program, treat it as a program git will run. - List the local config with its source file. From outside the folder, or from the folder without running a status or diff, run:
git -C /path/to/repo config --local --list --show-origin
include.pathorincludeIfsetting, and git inserts the included file's contents at the point of the include, as if they had been written in the including file. If any line came from a file other than.git/config, or the config contains aninclude.pathorincludeIfline, open that included file as text as well and apply the same rule to it: any setting in it that names a program is a setting git will run. - Look for
core.fsmonitor. This is the documented performance setting whose value is a helper program git runs during an index refresh. A legitimate value names a filesystem monitor such as Watchman. Any other program, or a program in a path you do not recognise, is a stop signal. - Look for
core.hooksPath. Git prints this key in lowercase, ascore.hookspath. It changes the directory git reads hooks from, and hooks are programs git runs at points in its execution. A hooks path pointing outside the repository, or at a directory you did not set up, is a stop signal. List the files in that directory, and in.git/hooks, without running any of them. - If the config is clean, open the folder as normal. A config with no program-naming settings, and a hooks directory holding only the sample files git ships, is the ordinary case. Keep the folder's origin in mind anyway: this audit says nothing about the code itself.
- If you find a program-naming setting, do not open the folder with an agent. Do not run git commands in it. Ask the sender for a fresh clone URL for the same repository, or for the files without the
.gitdirectory, and say which setting you found. If you must keep the folder, remove the one setting withgit -C /path/to/repo config --local --unset core.fsmonitor— and read the next section before trusting that removal, because it is not a complete fix on its own.
The 1 September 2026 snapshot, and why it is dated
Manifold retested the affected agents on 1 September 2026. At that date, Goose was fixed in 1.44.0 and Cursor was patched; Manifold lists OpenAI Codex as patched without naming a version, and coverage of the report names 0.131.0 as the fixed version. Claude Code's core.fsmonitor path was fixed in 2.1.196. Hermes Agent, Qwen Code (0.22.3), and Grok Build were unpatched at that date, and a second Claude Code path behind claude ultrareview was unpatched at 2.1.252 — it uses a different config key that Manifold has not published while it remains unpatched. That snapshot is the most recent published retest in Manifold's disclosure. It is not a statement about any agent's current version. Before relying on a fix for the agent you run, read that vendor's release notes for the version you have installed, and note the version number. A fix claimed for one version says nothing about the version on your machine.
The unpublished second key is the reason removing core.fsmonitor is necessary but not sufficient: unsetting one key cannot close a path that turns on a different, unnamed key. Setting core.fsmonitor=false in your global config is likewise not sufficient, because the repository's local config takes precedence for that folder. Manifold's suggested form for vendors is to pass the override on the call itself, as in git -c core.fsmonitor=false status, which overrides the repository value for that one call.
What can go wrong
- Running a status check first to "see if it is a git repo." That is the trigger. The config read comes first, always.
- Reading only the
core.fsmonitorline. The withheld second key means a cleanfsmonitorline does not prove the config is safe. Apply the any-program rule to every line, and check the hooks path too. - Treating the trust prompt as protection. In the tested cases the payload ran before the prompt was accepted, or before authentication. A prompt that appears after the command ran protects nothing.
- Treating a clean audit as a clean repository. This audit covers git config only. The code, hooks, skills, and other files in the folder still need the same care as any code you did not write.
Limits
- Manifold deliberately published minimal detail and left one config key unnamed while it remains unpatched. This page cannot name a key the disclosure withholds, and no audit built on the published keys can rule that path out.
- The patch snapshot above is dated 1 September 2026. Patch status after that date is a question for each vendor's release notes, not for this page.
Related playbooks
- Audit apps that installed agent plugins for you
- Check your Codex and Claude Code config for relay tampering: base URL, sandbox, and credentials you did not set
- Git 2.56.1: patch the recursive-clone bug
- What AI monitoring missed, per the METR audit
Sources
- https://www.manifold.security/blog/ai-coding-agents-git-hijack
- http://thehackernews.com/2026/09/malicious-git-configs-can-make-claude.html
- http://git-scm.com/docs/githooks
Back to: Coding playbooks hub · Also: Open an untrusted repo without running code · Check DeepSeek's dsh tool is really running the version with the sandbox-escape fix