Repository navigation
TC CFG 006
| Severity | high (home, temp, remote URL); medium (other absolute path, .., referenced script missing from repo); low for any of these in a config under a test or fixture directory, or in a home/ mirror (a dotfiles home/, or a container image's home/ beside its Dockerfile) |
| Harnesses | Claude Code, Codex, Copilot, Cursor, Gemini CLI, Windsurf, shared skills (generic) |
| Files | every hook any adapter normalizes, repository scope, except settings.local.json
|
| Rule | rules/TC-CFG-006.yaml |
A committed hook whose target is not committed with it. Review sees the hook line, but what runs is whatever sits at the target when the hook fires. The npm worm of August 2026 used this to persist: a hook in shared config pointing at a script it had written elsewhere on the machine.
Each command field (command, bash, powershell, exec and args,
commandWindows, windows, linux, osx) is read by
shell.locations, which follows the same wrappers as shell.risks
(sudo, env, bash -c, pwsh -Command, cmd /c, eval). It looks
at the program of every simple command and at the script an interpreter
is given: bash x.sh, python x.py, node x.js, deno run x.ts,
pwsh -File x.ps1, source x.
| Target | Severity |
|---|---|
A hook url (HTTP hook) or program at a non-loopback URL, or a UNC share |
high |
Under the home directory: ~, $HOME, %USERPROFILE%, $env:APPDATA, XDG_*_HOME, /home/<user>, /Users/<user>, /root, C:\Users\<user>
|
high |
A temporary directory: /tmp, /var/tmp, /dev/shm, /private/tmp, /var/folders, $TMPDIR, %TEMP%, $RUNNER_TEMP, C:\Windows\Temp
|
high |
Any other absolute path, such as /opt/vgmartinez/hooks/check.sh or D:\tools\x.ps1
|
medium |
Above the project directory: ../x.sh, $CLAUDE_PROJECT_DIR/../x.sh
|
medium |
| A project script the hook runs that is not in the scanned tree | medium, titled "Referenced script missing from repo" |
When several apply, the first row in this order decides the severity and title.
A hook in a config under a directory named fixtures, __fixtures__,
testdata, test-fixtures, test_fixtures, tests, or test, at any
depth, is reported at low with the title the table above gives it. Such
a config is test input, for example an older settings file kept to test
a migration: a harness loads its config from the project root, not from
a nested copy, and the scripts the copy names are often left out on
purpose. It is still reported so a hook placed there stays visible.
tests/fixtures/old-release/.claude/settings.json running
"$CLAUDE_PROJECT_DIR"/.claude/hooks/format.ts, which the fixture does
not include, is low. A directory whose name only contains one of these
words (contests/, latest/) is not demoted, and neither is the
repository-root config.
A dotfiles repository often keeps the files it installs into its owner's
home directory under a top-level home/, which GNU Stow, rcm, or a
setup script links into ~: home/.zshenv becomes ~/.zshenv and
home/.claude/settings.json becomes ~/.claude/settings.json. That
settings file is the owner's user-level config. Nobody gets it by
opening the repository, and its hooks naturally point into the owner's
home directory (/Users/<name>/.local/...).
An item is in such a mirror when all of these hold:
- its path starts with
home/<dir>/, wherehomeis at the repository root and<dir>is a harness config directory (.claude,.cursor,.github,.windsurf,.devin,.codex,.gemini,.agents); -
home/is a real directory, not a symlink; - every direct child of
home/is a dot-entry (.claude,.zshenv,.config). A single other entry, such ashome/index.tsorhome/components/, meanshome/is part of the project and nothing under it is demoted.
Every finding on such an item is reported at low, whatever the rule
(TC-CFG-004, TC-CFG-005, TC-CFG-010, and the others as well as this
one), with the title and fingerprint it would have otherwise. The
severity rows above do not change: a root .claude/settings.json in the
same repository that runs ~/.claude/hooks/guard.sh is still high, and so
is a home/ deeper in the tree (src/home/.claude/settings.json) unless
it is a container image's home directory, below.
A repository that builds container images for coding agents often keeps
each image user's home directory next to the image's Dockerfile, which
copies it into the image: images/agent/home/.codex/config.toml becomes
/home/agent/.codex/config.toml inside the container. That file is the
image user's config, its hooks point into that user's home directory
(sh /home/agent/.codex/notify.sh), and nobody gets it by opening the
repository.
A home/ below the repository root is such a mirror when all of these
hold, and then every finding on an item in it is reported at low, the
same way as above:
- the item's path is
<dir>/home/<config dir>/..., with<config dir>one of the harness config directories listed above; -
<dir>, the directory that holdshome/, has a regular file namedDockerfileorContainerfile(exactly;Dockerfile.dev, adockerfile, a directory, a symlink, or a build file higher up does not count); - neither
home/nor any directory on the way to it is a symlink; - every direct child of
home/is a dot-entry (.bashrc,.codex). A single other entry, such ashome/setup.sh, means nothing under it is demoted.
A nested home/ without an image build file beside it keeps its
severity. A root config that runs a script from the image's home
(.claude/settings.json running sh /home/agent/.codex/notify.sh) is
still high: it is the repository's own config, and the script it names
is outside the repository.
Anyone can commit home/.claude/ next to a home/.zshenv, or a
one-line Dockerfile next to a home/ anywhere in the tree. That is why
a mirror lowers the severity instead of dropping the finding, so a hook
placed there stays visible at low. A harness would load such a config as
project config only if a session were started inside that home/.
The rule reads text, not a machine, so it decides some cases by rule of thumb. These are the ones a reviewer should know.
What counts as remote. A hook url, or a program or script written
as an http, https, or ftp URL, whose host is not loopback
(localhost, 127.0.0.0/8, [::1]), and a UNC path (\\host\share,
//host/share). A UNC path is high in every command field, bare,
quoted, or as a -File or interpreter script, including a Copilot
powershell field: a POSIX shell would read an unquoted \\ as one
backslash, but cmd.exe and PowerShell run the file from the share, and
a hook does not say which shell runs it. The Windows extended-length
and device prefixes name the same path: \\?\C:\Users\bob\x.bat and
\\.\C:\Users\bob\x.bat are C:\Users\bob\x.bat (home, high), and
\\?\UNC\host\share\x.cmd is the UNC path \\host\share\x.cmd. Any
other device path, such as \\.\pipe\x, stays a UNC-shaped path. A URL that is only an argument (./notify.sh https://...) is not a target. A curl or wget inside the command is
not read by this rule: TC-CFG-001 reports it in session-start hooks and
TC-CFG-008 in Cursor, Copilot, and Windsurf hooks.
Project variables. $CLAUDE_PROJECT_DIR, $CLAUDE_PLUGIN_ROOT,
$GEMINI_PROJECT_DIR, $CURSOR_PROJECT_DIR, and $PWD, written
$NAME, ${NAME}, %NAME%, or $env:NAME, are taken to be the
project, so a path under them is inside the repository. ../ after one
still climbs out and is medium. Any other variable ($HOOKS_DIR/x.sh)
and any command substitution has no known value and is not reported.
System directories. A program without a script extension under
/usr, /bin, /sbin, /lib, /lib64, /opt, /nix, /snap,
/etc, /Applications, /System, /Library, C:\Windows,
C:\Program Files, C:\Program Files (x86), or C:\ProgramData is
taken to be an installed binary, such as /usr/local/bin/tripcord or
/opt/homebrew/bin/prettier, and is not reported. A script there (by
extension: .sh, .py, .js, .mjs, .cjs, .ts, .rb, .pl,
.php, .lua, .ps1, .cmd, .bat, ...) is reported as medium, for
example /opt/vgmartinez/hooks/check.sh.
Programs on PATH. A bare name (npx, jq, tripcord) is a
PATH lookup and has no location.
Arguments. Only the program and an interpreter's script are read:
cp {} /tmp/backup/ and >> ~/.claude/audit.log run cp and echo.
Missing scripts. A project script is a program written as a path
(./x.sh, scripts/x, "$CLAUDE_PROJECT_DIR"/.claude/hooks/x.sh) or an
interpreter's script (bash x.sh, node .cursor/hooks/x.mjs). It is
looked up relative to the hook's project directory: the directory that
holds the harness's config directory (.claude, .cursor, .github,
.windsurf, .devin, .codex, .gemini, .agents), so a hook in
packages/web/.claude/settings.json resolves ./x.sh to
packages/web/x.sh. A Copilot hook's relative cwd is joined to it.
The lookup calls os.Stat and then filepath.EvalSymlinks on the whole
path, so a symlink in a parent directory counts as well as a symlink in
the last component. A target
outside the repository is reported as a script outside the repo, at the
severity of that target: home or a temporary directory is high, and any
other absolute path, including a system path such as /etc/passwd, is
medium. A symlink that does not resolve, including a broken link, counts
as missing, and so does any other error from the lookup. It is not checked:
- when the line contains a backslash, because POSIX and PowerShell
split it differently (
.\scripts\x.ps1); - after
cd,pushd, orSet-Locationon the same line; - for a bare operand without a directory or extension (
node server), which the interpreter may resolve to another file; - for paths with any other variable or a glob, and for
$CLAUDE_PLUGIN_ROOTpaths; - for hooks in a file outside those config directories, such as a
Claude plugin's
hooks/hooks.json. - for a tool a package manager installs into the project directory:
node_modules/.bin/<name>, andbin/<name>orScripts/<name>under.venvorvenv(./node_modules/.bin/prettier,"$CLAUDE_PROJECT_DIR"/.venv/bin/python). These directories are install output and are not committed. Only that exact shape directly under the project directory is skipped:../node_modules/.bin/xis still above the project (medium), and a missingtools/node_modules_bin/xor.claude/hooks/x.shis still reported.
Not reported at all: .claude/settings.local.json and
.github/copilot/settings.local.json, which are personal.
- Whether a script that exists is committed. The scan does not run git, so an untracked or gitignored script counts as present. Reading the git index is a follow-up.
- What the target script does. Only the hook entry is read.
- User-scope hooks.
negativos/malformed-fields.jsonincludes~/.cursor/hooks.jsonrunning~/.cursor/hooks/stop.sh, and that negative stays as it is, so the rule still requires repository scope. A home path on that item would match if the scope gate were opened.
Reported:
{"hooks": {"PreToolUse": [{"matcher": "Bash", "hooks": [
{"type": "command", "command": "~/.claude/hooks/guard.sh"}]}]}}{"version": 1, "hooks": {"postToolUse": [
{"type": "command", "exec": "node", "args": ["/tmp/lint-hook/index.js"]}]}}{"hooks": {"PreToolUse": [{"matcher": "*", "hooks": [
{"type": "http", "url": "https://hooks.example.invalid/pre-tool"}]}]}}Reported as "Referenced script missing from repo", when
.cursor/hooks/redact.mjs is not in the tree:
{"version": 1, "hooks": {"beforeShellExecution": [
{"command": "node .cursor/hooks/redact.mjs"}]}}Not reported, when .claude/hooks/guard.sh is in the tree:
{"hooks": {"PreToolUse": [{"matcher": "Bash", "hooks": [
{"type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/guard.sh"},
{"type": "command", "command": "/usr/local/bin/tripcord hook --harness claude --event pre-tool"}]}]}}A committed script that a SessionStart or Setup hook (Cursor:
sessionStart) runs is not a finding either. It is listed in the
informational auto-run hook inventory, so a
reviewer still sees what runs when a session starts.
Commit the script and reference it by a project-relative path, for
example "$CLAUDE_PROJECT_DIR"/.claude/hooks/check.sh or
.cursor/hooks/audit.sh, so review covers what the hook runs. Replace
an HTTP hook to a remote host with a committed command hook. A hook
that only makes sense on one machine belongs in that user's own
settings, not in the repository.
This wiki is generated from docs/ on main by cmd/wikigen. Do not edit it here: change docs/ and open a pull request. Apache-2.0.
Start
Commands
CI and hooks
Configuration
Adapters
- Claude Code
- Codex
- Cursor
- GitHub Copilot
- Gemini CLI
- OpenCode
- Windsurf
- Devin
- Dev Container
- Shared Files
Project